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

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

问题描述

我收到此错误:

在@INC中找不到Foo.pm

有没有比下载、解压、制作等更简单的安装方法?

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

推荐答案

在 Unix 上:

通常您在 shell 中启动 cpan:

usually you start cpan in your shell:

$ cpan

并输入

安装 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>搜索 net-smtp
<代码>ppm>安装 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

您应该总是喜欢它们,因为您可以从自动(安全)更新删除的便利中受益.使用 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天全站免登陆