安装缺少的Perl模块的最简单方法是什么? [英] What's the easiest way to install a missing Perl module?

查看:223
本文介绍了安装缺少的Perl模块的最简单方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误:

Can't locate Foo.pm in @INC

是否有比下载,解压缩,制作等更简单的安装方法?

Is there an easier way to install it than downloading, untarring, making, etc?

推荐答案

在Unix上:

通常您在外壳中启动 cpan :

# cpan

然后输入

install Chocolate::Belgian

或简称:

cpan Chocolate::Belgian

在Windows上:

如果您在Windows上使用ActivePerl,则 PPM( Perl软件包管理器)具有与CPAN.pm相同的功能.

If you're using ActivePerl on Windows, the PPM (Perl Package Manager) has much of the same functionality as CPAN.pm.

示例:

# ppm
ppm> search net-smtp
ppm> install Net-SMTP-Multipart

# ppm
ppm> search net-smtp
ppm> install Net-SMTP-Multipart

请参见如何安装Perl模块? CPAN常见问题解答

see How do I install Perl modules? in the CPAN FAQ

许多发行版都将许多perl模块作为软件包提供.

Many distributions ship a lot of perl modules as packages.

  • Debian/Ubuntu:apt-cache search 'perl$'
  • Arch Linux:pacman -Ss '^perl-'
  • Gentoo:类别dev-perl
  • Debian/Ubuntu: apt-cache search 'perl$'
  • Arch Linux: pacman -Ss '^perl-'
  • Gentoo: category dev-perl

您应该始终更喜欢它们,因为您将从自动(安全)更新删除的便利中受益.使用 cpan 工具本身可能会非常棘手.

You should always prefer them as you benefit from automatic (security) updates and the ease of removal. This can be pretty tricky with the cpan tool itself.

对于Gentoo,有一个很好的工具,叫做 g-cpan ,它将通过CPAN构建/安装模块并创建一个Gentoo包( ebuild )为你.

For Gentoo there's a nice tool called g-cpan which builds/installs the module from CPAN and creates a Gentoo package (ebuild) for you.

这篇关于安装缺少的Perl模块的最简单方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆