无法找到 perl 的模块/Build.pm

mah*_*ood 3 perl

我不是 perl 专家(请参阅此页面),但是为了使用包,我必须运行一些 perl 命令。该命令显示此错误

$ perl Build.PL
Can't locate Module/Build.pm in @INC (@INC contains: /home/mahmood/src/bioperl-1.6.1 /home/mahmood/src/ensembl/modules 
/home/mahmood/src/ensembl-compara/modules /home/mahmood/src/ensembl-variation/modules 
/home/mahmood/src/ensembl-funcgen/modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl 
/usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Build.PL line 20.
BEGIN failed--compilation aborted at Build.PL line 20.
Run Code Online (Sandbox Code Playgroud)

我看到此回复提供cpan Module::Build先运行以修复该错误。当我运行该命令时,我看到一堆问题(文本向导),它们询问我一个镜像 url。然后它以交互方式询问我安装软件包的许可。问题的默认答案似乎具有这种效果。我也没有找到哪个问题对此负责。请查看pastebin的完整输出。

有什么方法可以自动安装模块,以便我可以将其放入脚本中以备将来使用。

更新:

似乎我必须输入 cpan.org 网址,但是在我之前的尝试中,我使用了镜像网站。我尝试了回复中提出的三个命令,但仍然出现相同的错误:

Please enter the URL of your CPAN mirror  http://www.cpan.org
Configuration does not allow connecting to the internet.
Current set of CPAN URLs:
  http://www.cpan.org
Enter another URL or RETURN to quit: []
New urllist
  http://www.cpan.org


Please remember to call 'o conf commit' to make the config permanent!


cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.

cpan[1]> o conf build_requires_install_policy yes
    build_requires_install_policy [yes]
Please use 'o conf commit' to make the config permanent!


cpan[2]> o conf prerequisites_policy follow
    prerequisites_policy [follow]
Please use 'o conf commit' to make the config permanent!


cpan[3]> o conf commit
commit: wrote '/home/mahmood/.cpan/CPAN/MyConfig.pm'

cpan[4]> quit
No history written (no histfile specified).
Lockfile removed.
mahmood@cluster:Bio-DB-HTS$ perl Build.PL
Can't locate Module/Build.pm in @INC (@INC contains: /home/mahmood/src/bioperl-1.6.1 /home/mahmood/src/ensembl/modules /home/mahmood/src/ensembl-compara/modules /home/mahmood/src/ensembl-variation/modules /home/mahmood/src/ensembl-funcgen/modules /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at Build.PL line 20.
BEGIN failed--compilation aborted at Build.PL line 20.
Run Code Online (Sandbox Code Playgroud)

Dav*_*oss 5

如果您想将 Module::Build 安装到您的系统库中,那么使用几乎肯定可用于您的系统的预构建包可能要容易得多。

如果您使用的是类似 RedHat 的 Linux 发行版,请尝试:

$ sudo yum install perl-Module-Build
Run Code Online (Sandbox Code Playgroud)

(尝试dnf而不是yum在较新版本的 Fedora 上。)

如果您使用的是类似 Debian 的 Linux 发行版,请尝试:

$ sudo apt-get install libmodule-build-perl
Run Code Online (Sandbox Code Playgroud)