2013-07-13 121 views
-1

我想使用local::lib,因爲我沒有系統管理權限,我想下載並安裝本地庫。我跑了以下內容:嘗試使用local :: lib和CPAN時的模塊安裝錯誤

perl Makefile.PL --bootstrap 

make test && make install 

echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >>~/.bashrc 

此我想通過CPAN 下載模塊後,通過運行perl -MCPAN -e shell install netAddr::IP但是當我運行我的程序它給了一個錯誤:

Can't locate NetAddr/IP.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at agha.pl line 8. 
BEGIN failed--compilation aborted at agha.pl line 8. 

我的人認爲這個意思模塊未安裝...所以我再次嘗試去通過CPAN,但現在給了一個錯誤(這是在Linux中):

-bash-3.2$ perl -MCPAN -e shell 

There seems to be running another CPAN process (pid 15611). Contacting... 
Other job is running. 
You may want to kill it and delete the lockfile, maybe. On UNIX try: 
kill 15611 
rm /homes/ar312/.cpan/.lock 
+0

這並不意味着模塊沒有安裝。這僅表示您的腳本無法找到它。你如何運行你的腳本。你修改腳本,以便它使用loacal :: lib嗎? – innaM

+0

我應該做些什麼改變。我目前使用 – user2536319

+0

#!/ usr/local/bin/perl – user2536319

回答

1

local::lib documentation

After writing your shell configuration file, be sure to re-read it to get the changed settings into your current shell's environment.

你忘了這樣做。

0

嚴格來說,通過安裝perlbrew可以節省大量時間和麻煩。

perlbrew is a tool to manage multiple perl installations in your $HOME directory. They are completely isolated perl universes. This approach has many benefits:

  • 沒有必要運行sudo來安裝CPAN模塊,任何更多。
  • 嘗試每月發佈的新perls。
  • 學習新的語言功能。
  • 根據不同的Perl版本測試您的產品代碼。
  • 離開供應商的Perl(附帶OS一)單獨
+0

儘管它沒有直接回答OP的問題,但這是一個絕對值得考慮的選項。 – Randall