我试图在Windows安装版本的Git Bash上使用use cpan git version 2.18.0.windows.1。我安装了Active Perl版本version 24, subversion 3 (v5.24.3) built for MSWin32-x64-multi-thread ,它位于中C:\Perl64\bin\perl.exe。我可以cpan在Windows下的cmd中正常运行,但是由于它附带的perl5,我似乎无法使其在git bash中运行。我要么得到此错误:
Can't locate CPAN/Author.pm in @INC (you may need to install the CPAN::Author module) (@INC contains: /c/Perl64/site/bin /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl) at /usr/share/perl5/core_perl/CPAN.pm line 19.
BEGIN failed--compilation aborted at /usr/share/perl5/core_perl/CPAN.pm line 19.
Compilation failed in require at /c/Octave/Octave-4.4.1/bin/cpan line 119.
BEGIN failed--compilation aborted at /c/Octave/Octave-4.4.1/bin/cpan line 119.
或者当我添加文件夹而不是保存CPAN文件夹,然后将文件夹保存Perl到@INC路径时,出现export PERL5LIB=/c/Perl64/lib此错误:
Cwd.c: loadable library and perl binaries are mismatched (got handshake key 0000000600000570, needed 0000000000000000)
这是添加后从@INC路径打印出来的内容:
~$ perl -e "print qq(@INC)"
/c/Perl64/lib /usr/lib/perl5/site_perl /usr/share/perl5/site_perl /usr/lib/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib/perl5/core_perl /usr/share/perl5/core_perl~$
我如何确保git bash像在Windows中一样运行cpan?
当我安装ActivePerl时添加的完整路径是C:\Perl64\bin包含该lib文件夹的文件夹,该CPAN文件夹包含该文件夹(及其中的Author.pm文件),C:\Perl64\site\bin并且cpan在Windows cmd中运行良好。
我最终尝试配置和安装所有我自己学习的git bash软件包,并解决了这些问题,因为当我尝试配置时遇到了这个问题。过去24小时内一直在此进行过操作:
intltool-0.51.0$ ./configure --prefix=/mingw
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... no
checking whether make supports nested variables... yes
checking for perl... /usr/bin/perl
checking for perl >= 5.8.1... 5.26.2
checking for XML::Parser... configure: error: XML::Parser perl module is required for intltool
小智 0
您可以在 Windows 上本地安装 perl,然后将 gitbash别名为该 perl。就我而言,我已将 perl 安装到C:\Perl64,然后添加到我的~/.bashrc
alias perl=/c/Perl64/bin/perl.exe
Run Code Online (Sandbox Code Playgroud)
然后,GitBash 将使用您安装的 perl,而不是随 git 提供的 perl。
| 归档时间: |
|
| 查看次数: |
759 次 |
| 最近记录: |