windows 下安裝 perl 模組手記

來源:互聯網
上載者:User

首先,推薦一個很好的模組下載網站: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

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.