首先,推荐一个很好的模块下载网站:http://search.cpan.org
今天在windows xp上安装了ActivePerl-5.12.2.1202-MSWin32-x86-293621.msi,在eclipse下打开项目,有好多地方提示错误都是因为本地没有安装相关的模块导致的,于是开始从上面的网站下载相关模板进行安装。
安装过程中遇到很多错,记录于此,希望能帮助到需要作类似操作的朋友。
网上也有说可以直接用PPM安装,类似于MS DOS>ppm install modelName,但我上班的地方,上网是通过代理的,不能在DOS命令下直接下载文件,所以,只好把相关的文件下载到本地再安装。
我的Perl安装目录:D:/Program Files/Perl
下面以安装Unicode::Map为例对碰到的问题一一解决。
1.在安装MinGW之前,会提示:
D:/Unicode-Map-0.112/Unicode-Map-0.112>perl Makefile.PL
It looks like you don't have a C compiler on your PATH, so you will not be
able to compile C or XS extension modules. You can install GCC from the
MinGW package using the Perl Package Manager by running:
ppm install MinGW
Unable to find a perl 5 (by these names: D:/Program Files/Perl/bin/perl.exe perl
.exe perl5.exe perl5.12.2.exe miniperl.exe, in these dirs: . D:/Program Files/Pe
rl/site/bin D:/Program Files/Perl/bin D:/oracle/product/10.2.0/client_1/bin C:/W
INDOWS/system32 C:/WINDOWS C:/WINDOWS/System32/Wbem D:/Program Files/TortoiseSVN
/bin C:/Program Files/Microsoft SQL Server/90/Tools/binn/ D:/Program Files/CodeS
mith/v5.2/ C:/Program Files/Common Files/Thunder Network/KanKan/Codecs D:/Progra
m Files/Perl/bin)
Writing Makefile for Unicode::Map
上面提到过,也可以直接用PPM安装需要的模板,如果网络畅通的话,比如通过命令:
D:/Unicode-Map-0.112/Unicode-Map-0.112>ppm install MinGW
2.下载MinGW,我下载的是mingw-get-inst-20101030.exe,安装,然后退出cmd窗口重新打开,再MakeFile.pl,这次得到的错误提示如下:
D:/Unicode-Map-0.112/Unicode-Map-0.112>perl Makefile.PL
It looks like you don't have a C compiler on your PATH, so you will not be
able to compile C or XS extension modules. You can install GCC from the
MinGW package using the Perl Package Manager by running:
ppm install MinGW
Unable to find a perl 5 (by these names: D:/Program Files/Perl/bin/perl.exe perl
.exe perl5.exe perl5.12.2.exe miniperl.exe, in these dirs: . D:/Program Files/Pe
rl/site/bin D:/Program Files/Perl/bin D:/oracle/product/10.2.0/client_1/bin C:/W
INDOWS/system32 C:/WINDOWS C:/WINDOWS/System32/Wbem D:/Program Files/TortoiseSVN
/bin C:/Program Files/Microsoft SQL Server/90/Tools/binn/ D:/Program Files/CodeS
mith/v5.2/ C:/Program Files/Common Files/Thunder Network/KanKan/Codecs D:/Progra
m Files/Perl/bin)
Writing Makefile for Unicode::Map
装了WinGW之后,没有设置环境变量,所以找不到GCC调用,会有上面的提示。
3.设置好后,错误提示又变了,如下:
Set up gcc environment - 4.5.0
It looks like you don't have either nmake.exe or dmake.exe on your PATH,
so you will not be able to execute the commands from a Makefile. You can
install dmake.exe with the Perl Package Manager by running:
ppm install dmake
Unable to find a perl 5 (by these names: D:/Program Files/Perl/bin/perl.exe perl
.exe perl5.exe perl5.12.2.exe miniperl.exe, in these dirs: . D:/Program Files/Pe
rl/site/bin D:/Program Files/Perl/bin D:/oracle/product/10.2.0/client_1/bin C:/W
INDOWS/system32 C:/WINDOWS C:/WINDOWS/System32/Wbem D:/Program Files/TortoiseSVN
/bin C:/Program Files/Microsoft SQL Server/90/Tools/binn/ D:/Program Files/CodeS
mith/v5.2/ C:/Program Files/Common Files/Thunder Network/KanKan/Codecs C:/MinGW/
bin C:/MinGW/lib/gcc/mingw32/4.5.0 D:/Program Files/Perl/bin)
Writing Makefile for Unicode::Map
windows下是没有made文件的,我下载了一个Dmade文件,链接如下:
http://search.cpan.org/CPAN/authors/id/S/SH/SHAY/dmake-4.12-20090907-SHAY.zip
解压之后将路径添加到环境变量。
4.进行到上面的步骤之后,再MakeFile就可以了。
D:/Unicode-Map-0.112>perl Makefile.PL
Set up gcc environment - 4.5.0
Writing Makefile for Unicode::Map
但在dmake时,遇到下面的错误
D:/Unicode-Map-0.112>dmake
dmake: Error: -- `D:/Program' not found, and can't be made
5.在网上搜了半天也没找到答案,差点儿都放弃了。查看编译好的文件Makefile(其实就是一个文本文件),看到有perl的安装的目录,而提示就是安装目录的前面部分,估计是安装目录带有空格,不能被dmake程序正确识别。
于是卸载Perl,重新安装到默认目录c:/perl,再dmake,成功!
6.总结
windows下安装perl模块,大部分都是下面的步骤:
perl Makefile.PL
dmake
dmake test
dmake install
windows 下安装 perl 模块手记
最新推荐文章于 2024-07-31 22:12:09 发布