首页

欢迎

 

Welcome

欢迎来到这里, 这是一个学习数学、讨论数学的网站.

转到问题

请输入问题号, 例如: 2512

IMAGINE, THINK, and DO
How to be a scientist, mathematician and an engineer, all in one?
--- S. Muthu Muthukrishnan

Local Notes

Local Notes 是一款 Windows 下的笔记系统.

Local Notes 下载

Sowya

Sowya 是一款运行于 Windows 下的计算软件.

详情

下载 Sowya.7z (包含最新版的 Sowya.exe and SowyaApp.exe)


注: 自 v0.550 开始, Calculator 更名为 Sowya. [Sowya] 是吴语中数学的发音, 可在 cn.bing.com/translator 中输入 Sowya, 听其英语发音或法语发音.





注册

欢迎注册, 您的参与将会促进数学交流. 注册

在注册之前, 或许您想先试用一下. 测试帐号: usertest 密码: usertest. 请不要更改密码.


我制作的 slides

Problem

随机显示问题

Problèmes d'affichage aléatoires

软件 >> Perl
Questions in category: Perl (Perl).

安装Perl后如何添加模块?

Posted by haifeng on 2021-10-25 10:01:21 last update 2024-09-12 16:53:26 | Answers (1)


比如现在需要在 Perl 中使用 ImageMagick, 在 .pl 文件中通常要写

use Image::Magick;

也就是启用 Image::Magick 模块. 如果 Perl 是默认安装的, 则不会预先安装此模块. 在执行 .pl 文件时, 会提示下面的信息

 

Can't locate Image/Magick.pm in @INC (you may need to install the Image::Magick module) (@INC contains: C:/Strawberry/perl/site/lib C:/Strawberry/perl/vendor/lib C:/Strawberry/perl/lib) at test.pl line 6.
BEGIN failed--compilation aborted at test.pl line 6.


如果安装的是 strawberry Perl, 则已经安装了 cpanm. 在 Windows 下可以通过 where cpanm 查看其是否能直接调用.

然后通过 

cpanm Module::Name

直接安装需要的模块. 模块可以在 CPAN 网上查找.

例如: 在命令符窗口下键入 cpanm Image::Magick  就可以安装 Image::Magick 模块.

 

cpanm Image::Magick
--> Working on Image::Magick
Fetching http://www.cpan.org/authors/id/J/JC/JCRISTY/Image-Magick-7.0.11-3.tar.gz ... OK
Configuring Image-Magick-7.0.11-3 ... OK
Building and testing Image-Magick-v7.0.11 ... FAIL
! Installing Image::Magick failed. See C:\Users\haife\.cpanm\work\1635127678.42820\build.log for details. Retry with --force to force install it.

 

 


键入 perl -MCPAN -e shell 可进入 CPAN 的 shell 模式

 

perl -MCPAN -e shell
Unable to get Terminal Size. The Win32 GetConsoleScreenBufferInfo call didn't work. The COLUMNS and LINES environment variables didn't work. at C:\Strawberry\perl\vendor\lib/Term/ReadLine/readline.pm line 410.

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

cpan>