我想在Windows 10(WSL)的Linux環境下使用Perl腳本。我已經啓用了WSL,安裝了編譯器(gcc
和make
),執行了sudo apt-get install build-essential
。 Perl正在工作,我可以運行簡單的腳本。我嘗試安裝perl模塊時出現問題。例如,我試圖通過運行perl -MCPAN -e'install "LWP"'
來添加LWP
。它提供了很多錯誤/警告消息,從Warning: the following files are missing in your kit:
開始。完整的輸出太大而無法粘貼在這裏,所以我必須把它放在其他地方:http://pastebin.com/RRRedwbG。簡而言之,無論是什麼包,所有的.pm和.t文件都被認爲是不存在的。在[Windows子系統for Linux]中安裝perl模塊
4
A
回答
4
的溶液中發現的在github.com/Microsoft/BashOnWindows/issues/186:
1.運行sudo apt-get install liblocal-lib-perl cpanminus build-essential
2.編輯/usr/lib/perl/5.18.2/Config.pm
(圍繞線94)以具有dont_use_nlink => 1
3. eval "$(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)"
5
在UNIX文件系統中,目錄的.
是硬鏈接自己,目錄的..
是一個硬鏈接到其父目錄。所以當你stat
一個目錄時,stat
返回的鏈接數將至少爲1 (name) + 1 (.) + $num_sub_dirs (..)
。
$ ls -ld .
drwx------ 5 ikegami ikegami 46 Dec 16 12:03 . # 5 = Could have up to three subdirs
$ ls -l .
total 0
drwx------ 2 ikegami ikegami 10 Dec 16 12:03 a # 2 = No subdirs
drwx------ 3 ikegami ikegami 24 Dec 16 12:03 b # 3 = Could have up to one subdir
drwx------ 2 ikegami ikegami 10 Dec 16 12:03 c # 2 = No subdirs
File :: Find在可能的情況下依賴於該信息進行優化。
Perl和File :: Find知道FAT和NTFS文件系統並非如此,所以在Windows上禁用了優化。但是,VSL看起來像一個Linux系統,所以他們錯誤地認爲他們正在處理一個unix文件系統。
最好的解決方法是編輯通過以下命令的輸出文件名爲:
perl -MConfig -e'CORE::say $INC{"Config.pm"}'
變化
dont_use_nlink => undef
到
dont_use_nlink => 1
可以使用驗證更改
$ perl -V:dont_use_nlink
dont_use_nlink='1';
此答案是基於this bug report。
相關問題
- 1. 在Linux的Windows子系統中安裝Windows共享
- 2. 安裝CPAN模塊而不搞亂系統Perl安裝
- 3. 安裝CPAN模塊而不搞亂系統Perl安裝
- 4. 無法在Linux上安裝Perl模塊
- 5. 安裝perl模塊錯誤
- 6. 如何在Windows上安裝perl模塊?
- 7. 在Windows上安裝Sqitch Perl CPAN模塊
- 8. 在XAMPP for Windows上安裝CPAN上的perl模塊
- 9. 在Android操作系統上安裝Perl模塊
- 10. 如何在Windows 10上的Linux子系統上安裝RVM
- 11. 如何在Windows上安裝pytorch Linux子系統
- 12. 在Linux操作系統上安裝ibm_db模塊問題
- 13. 如何在Windows中安裝Mason for Perl?
- 14. Perl模塊安裝?
- 15. 安裝Class :: Inspector Perl模塊
- 16. 如何使用系統命令安裝cpan模塊 - perl
- 17. Ubuntu在哪裏安裝Perl模塊?
- 18. Linux的Windows子系統:安裝MSSQL服務器時出錯
- 19. 重新安裝或刷新Windows子系統Linux上的文件
- 20. 如何在Linux系統中安裝tcl
- 21. perl cpan模塊安裝
- 22. 在Ubuntu中顯示matplotlib圖(Linux子系統的Windows子系統)
- 23. 爲(非系統)Python安裝rpm模塊
- 24. Perl DBD :: Oracle模塊安裝
- 25. oracle perl和perl系統並排安裝
- 26. 無法在Windows 64位上安裝perl模塊Net :: SSH :: Perl
- 27. 如何在Linux中安裝py2exe模塊
- 28. 在Linux上構建Windows Perl模塊
- 29. PERL 5.8.4安裝DBI模塊
- 30. 的Perl模塊安裝
可能是這個問題:https://github.com/Microsoft/BashOnWindows/issues/186 – melpomene
是的!我剛剛發現它也是 –
@VasilyA順便說一下,你可以做'cpan LWP'。不需要搞亂'perl -MCPAN -e ...'。 – melpomene