我是 Ubuntu 新手,出于某种原因,我无法安装任何 Perl 模块。这是我第一次尝试安装模块,我相信,解决这个问题就可以解决其余的问题。希望如此!
$ cpanm AnyEvent
Can't write to /usr/local/share/perl/5.26.1 and /usr/local/bin: Installing modules to /home/cougar/perl5
To turn off this warning, you have to do one of the following:
- run me as a root or with --sudo option (to install to /usr/local/share/perl/5.26.1 and /usr/local/bin)
- Configure local::lib in your existing shell to set PERL_MM_OPT etc.
- Install local::lib by running the following commands
cpanm --local-lib=~/perl5 local::lib && eval $(perl -I ~/perl5/lib/perl5/ -Mlocal::lib)
--> Working on AnyEvent
Fetching http://www.cpan.org/authors/id/M/ML/MLEHMANN/AnyEvent-7.15.tar.gz ... OK
==> Found dependencies: Canary::Stability
--> Working on Canary::Stability
Fetching http://www.cpan.org/authors/id/M/ML/MLEHMANN/Canary-Stability-2013.tar.gz ... OK
Configuring Canary-Stability-2013 ... OK
Can't configure the distribution. You probably need to have 'make'. See /home/cougar/.cpanm/work/1559943124.9523/build.log for details.
Installing the dependencies failed: Module 'Canary::Stability' is not installed
Bailing out the installation for AnyEvent-7.15.
请帮忙!
答案1
下载时cpanminus
您必须已经make
安装过 Perl 模块。
sudo cpan App::cpanminus
sudo apt install make
另外,我有一个模块一直无法安装。所以我下载了它,并将其解压到它自己的文件夹中。
然后我导航到该文件夹并运行make
命令。
它告诉我为什么无法安装:没有 GCC 编译器。
一旦安装了编译器,所有模块都已成功下载并安装!
希望这对某人有帮助。
答案2
由于/usr/local/share/perl/5.26.1
和/usr/local/bin
是“系统”目录,普通用户对它们没有写权限。
最简单的解决方法cpanm
是root
使用
sudo cpanm AnyEvent