bdd 启动 data processing进程报错 Can't locate LWP.pm in @INC

栏目: Perl · 发布时间: 7年前

内容简介:bdd 启动 data processing进程报错 Can't locate LWP.pm in @INC

bdd 启动 data processing进程报错 Can't locate LWP.pm in @INC

Can't locate LWP.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .).

BEGIN failed--compilation aborted.

安装CPAN的方法 yum -y install perl-CPAN

解决方法:

History of LWP Introduction to Web Automation Words of Caution

1.3. Installing LWP

LWP and the associated modules areavailablein various distributions free from the Comprehensive Perl ArchiveNetwork (CPAN). The main distributionsare listed at the start of Appendix A, "LWP Modules" , although thedetails of which modules are in which distributions changeoccasionally.

If you're using ActivePerl forWindows or MacPerlfor Mac OS 9, you already have LWP. If you're onUnix and you don't already have LWP installed,you'll need to install it from CPAN usinginstructions given in the next section.

To test whether you already have LWP installed:

% perl -MLWP -le "print(LWP->VERSION)"

(The second character in -le is a lowercase L, nota digit one.)

If you see:

Can't locate LWP in @INC (@INC contains: ...lots of paths...).
BEGIN failed--compilation aborted.

or if you see a version number lower than 5.64, you need to installLWP on your system.

There are two ways to install modules: using the CPAN shell or theold-fashioned manual way.

1.3.1. Installing LWP from the CPAN Shell

The CPAN shell is a command-line environmentfor automatically downloading,building, and installing modules from CPAN.

1.3.1.1. Configuring

If you have never used the CPAN shell, you will need to configure itbefore you can use it. It will prompt you for some information beforebuilding its configuration file.

Invoke the CPAN shell by entering the following command at a systemshell prompt:

% perl -MCPAN -eshell

If you've never run it before,you'll see this:

We have to reconfigure CPAN.pm due to following uninitialized parameters:

followed by a number of questions. For each question, the defaultanswer is typically fine, but you may answer otherwise if you knowthat the default setting is wrong or not optimal. Onceyou've answered all the questions, a configurationfile is created and you can start working with the CPAN shell.

1.3.1.2. Obtaining help

If you need help at any time, you can read the CPANshell's manual page by typing perldoc CPAN or by starting upthe CPAN shell (with perl -MCPAN -eshell at a systemshell prompt) and entering h at the cpan> prompt:

cpan> h
 
Display Information
 command  argument          description
 a,b,d,m  WORD or /REGEXP/  about authors, bundles, distributions, modules
 i        WORD or /REGEXP/  about anything of above
 r        NONE              reinstall recommendations
 ls       AUTHOR            about files in the author's directory
 
Download, Test, Make, Install...
 get                        download
 make                       make (implies get)
 test      MODULES,         make test (implies make)
 install   DISTS, BUNDLES   make install (implies test)
 clean                      make clean
 look                       open subshell in these dists' directories
 readme                     display these dists' README files
 
Other
 h,?           display this menu       ! perl-code   eval a perl command
 o conf [opt]  set and query options   q             quit the cpan shell
 reload cpan   load CPAN.pm again      reload index  load newer indices
 autobundle    Snapshot                force cmd     unconditionally do cmd

1.3.1.3. Installing LWP

All you have to do is enter:

cpan> install Bundle::LWP

The CPAN shell will show messages explaining whatit's up to. You may need to answer questions toconfigure the various modules (e.g., libnet asks for mail hosts andso on for testing purposes).

After much activity, you should then have a fresh copy of LWP on yoursystem, with far less work than installing it manually onedistribution at a time. At the time of this writing, installBundle::LWP installs not just the libwww-perl distribution,but also URI and HTML-Parser. It does not install the HTML-Treedistribution that we'll use in Chapter 9, "HTML Processing with Trees" and Chapter 10, "Modifying HTML with Trees" . To do that,enter:

cpan> install HTML::Tree

These commands do not install the HTML-Format distribution, which wasalso once part of the LWP distribution. I do not discuss HTML-Formatin this book, but if you want to install it so that you have acomplete LWP installation, enter this command:

cpan> install HTML::Format

Remember, LWP may be just about the most popular distribution inCPAN, but that's not all there is! Look around theweb-related parts of CPAN (I prefer the interface at http://search.cpan.org , but you can also try http://kobesearch.cpan.org ) asthere are dozens of modules, from WWW::Automate to SOAP::Lite, thatcan simplify your web-related tasks.

1.3.2. Installing LWP Manually

The normal Perl moduleinstallation procedure is summed up inthe document perlmodinstall . You can read thisby running perldoc perlmodinstall at a shell prompt or online at http://theoryx5.uwinnipeg.ca/CPAN/perl/pod/perlmodinstall.html .

CPAN is a network of a large collection of Perl software anddocumentation. See the CPAN FAQ at http://www.cpan.org/misc/cpan-faq.html formore information about CPAN and modules.

1.3.2.1. Download distributions

First, download the moduledistributions.LWP requires several other modules to operate successfully.You'll need to install the distributions given in Table 1-1 , in the order in which they are listed.

Table 1-1. Modules used in this book

Distribution

CPAN directory

MIME-Base64

authors/id/G/GA/GAAS

libnet

authors/id/G/GB/GBAAR

HTML-Tagset

authors/id/S/SBURKE

HTML-Parser

authors/id/G/GA/GAAS

URI

authors/id/G/GA/GAAS/URI

Compress-Zlib

authors/id/P/PM/PMQS/Compress-Zlib

Digest-MD5

authors/id/G/GA/GAAS/Digest-MD5

libwww-perl

authors/id/G/GA/GAAS/libwww-perl

HTML-Tree

authors/id/S/SB/SBURKE/HTML-Tree

Fetch these modules from one of the FTP or web sites that form CPAN,listed at http://www.cpan.org/SITES.html and http://mirror.cpan.org . SometimesCPAN has several versions of a module in the authors directory. Be sure to check the versionnumber and get the latest.This book is about the latest version of LWP! Upgrade now!

For example to install MIME-Base64, you might first fetch http://www.cpan.org/authors/id/G/GA/GAAS/ tosee which versions are there, then fetch http://www.cpan.org/authors/id/G/GA/GAAS/MIME-Base64-2.12.tar.gz and install that.

1.3.2.2. Unpack and configure

The distributions are gzipped tararchives of source code.Extracting a distribution creates a directory, and in that directoryis a Makefile.PL Perl program that builds a Makefile for you.

% tar xzf MIME-Base64-2.12.tar.gz
% cd MIME-Base64-2.12
% perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for MIME::Base64

1.3.2.3. Make, test, and install

Compile the code with the make command:

% make
cp Base64.pm blib/lib/MIME/Base64.pm
cp QuotedPrint.pm blib/lib/MIME/QuotedPrint.pm
/usr/bin/perl -I/opt/perl5/5.6.1/i386-freebsd -I/opt/perl5/5.6.1
/opt/perl5/5.6.1/ExtUtils/xsubpp  -typemap
/opt/perl5/5.6.1/ExtUtils/typemap Base64.xs > Base64.xsc && mv
  Base64.xsc Base64.c
cc -c  -fno-strict-aliasing -I/usr/local/include -O    -DVERSION=\"2.12\"
  -DXS_VERSION=\"2.12\" -DPIC -fpic -I/opt/perl5/5.6.1/i386-freebsd/CORE
Base64.c
Running Mkbootstrap for MIME::Base64 ( )
chmod 644 Base64.bs
rm -f blib/arch/auto/MIME/Base64/Base64.so
LD_RUN_PATH="" cc -o blib/arch/auto/MIME/Base64/Base64.so  -shared
  -L/opt Base64.o
chmod 755 blib/arch/auto/MIME/Base64/Base64.so
cp Base64.bs blib/arch/auto/MIME/Base64/Base64.bs
chmod 644 blib/arch/auto/MIME/Base64/Base64.bs
Manifying blib/man3/MIME::Base64.3
Manifying blib/man3/MIME::QuotedPrint.3

Then make sure everything works on your system with maketest :

% make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib 
-I/opt/perl5/5.6.1/i386-freebsd -I/opt/perl5/5.6.1 -e 'use Test::Harness
  qw(&runtests $verbose); $verbose=0; runtests @ARGV;' t/*.t
t/base64..........ok
t/quoted-print....ok
t/unicode.........skipped test on this platform
All tests successful, 1 test skipped.
Files=3, Tests=306,  1 wallclock secs ( 0.52 cusr +  0.06 csys =  0.58 CPU)

If it passes the tests, install it with make install (as the superuser):

# make install
Installing /opt/perl5/site_perl/5.6.1/i386-freebsd/auto/MIME/Base64/Base64.so
Installing /opt/perl5/site_perl/5.6.1/i386-freebsd/auto/MIME/Base64/Base64.bs
Files found in blib/arch: installing files in blib/lib into architecture
  dependent library tree
Installing /opt/perl5/site_perl/5.6.1/i386-freebsd/MIME/Base64.pm
Installing /opt/perl5/site_perl/5.6.1/i386-freebsd/MIME/QuotedPrint.pm
Installing /usr/local/man/man3/MIME::Base64.3
Installing /usr/local/man/man3/MIME::QuotedPrint.3
Writing /opt/perl5/site_perl/5.6.1/i386-freebsd/auto/MIME/Base64/.packlist
Appending installation info to /opt/perl5/5.6.1/i386-freebsd/perllocal.pod

Continue to section: Words of Caution

=====================

如果上面的方法不成功,试试

yum install perl-LWP-UserAgent-Determined.noarch


以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

水平营销

水平营销

[美] 菲利普·科特勒、费尔南多・德・巴斯 / 陈燕茹 / 中信出版社 / 2005-1 / 25.00元

《水平营销》阐明了相对纵向营销而言的的水平营销的框架和理论。引入横向思维来作为发现新的营销创意的又一平台,旨在获得消费者不可能向营销研究人员要求或建议的点子。而这些点子将帮助企业在产品愈加同质和超竞争的市场中立于不败之地。 《水平营销》提到: 是什么创新过程导致加油站里开起了超市? 是什么创新过程导致取代外卖比萨服务的冷冻比萨的亮相? 是什么创新过程导致巧克力糖里冒出了玩具......一起来看看 《水平营销》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

HTML 编码/解码
HTML 编码/解码

HTML 编码/解码

Markdown 在线编辑器
Markdown 在线编辑器

Markdown 在线编辑器