CPAN installing modules into perl5 instead of site_perl

旧城冷巷雨未停 提交于 2019-12-01 07:39:28

Unless you override ExtUtils::MakeMaker and Module::Build through environment variables (i.e. values in PERL_MM_OPT and PERL_MB_OPT) or command line arguments (e.g. values in cpan's mbuildpl_arg and makepl_arg), locations hardcoded into Perl when it was built will be used. The following command will show you those locations (for .pm and associated files):

perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
  • installprivlib contains the "pure Perl" modules that came with Perl.
  • installarchlib is the same for modules with arch- or build-dependent components.
  • installvendorlib contains the "pure Perl" modules installed by your distro.
  • installvendorarch is the same for modules with arch- or build-dependent components.
  • installsitelib contains the "pure Perl" modules installed by you.
  • installsitearch is the same for modules with arch- or build-dependent components.

Example runs:

$ perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
installprivlib='/usr/share/perl/5.14';
installarchlib='/usr/lib/perl/5.14';
installvendorlib='/usr/share/perl5';
installvendorarch='/usr/lib/perl5';
installsitelib='/usr/local/share/perl/5.14.2';
installsitearch='/usr/local/lib/perl/5.14.2';

$ perl -V:'install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)'
installprivlib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/5.20.1';
installarchlib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/5.20.1/x86_64-linux-thread-multi';
installvendorlib='';
installvendorarch='';
installsitelib='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/site_perl/5.20.1';
installsitearch='/home/ikegami/usr/perlbrew/perls/5.20.1t/lib/site_perl/5.20.1/x86_64-linux-thread-multi';

>perl -V:"install(privlib|archlib|vendorlib|vendorarch|sitelib|sitearch)"
installprivlib='C:\progs\sp5280-x64\perl\lib';
installarchlib='C:\progs\sp5280-x64\perl\lib';
installvendorlib='C:\progs\sp5280-x64\perl\vendor\lib';
installvendorarch='C:\progs\sp5280-x64\perl\vendor\lib';
installsitelib='C:\progs\sp5280-x64\perl\site\lib';
installsitearch='C:\progs\sp5280-x64\perl\site\lib';

There is no answer posted here. I have the same problem. cpan and cpanm installs are going into (using X to shorten paths):

/X/lib/perl5

but that path is not in @INC:

perl -V

  @INC:
/X/lib/perl5/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/5.22.0
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/site_perl
/X/lib/perl5/site_perl/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/site_perl/5.22.0
/X/lib/perl5/5.22.0/x86_64-linux-thread-multi
/X/lib/perl5/5.22.0

PERL_MM_OPT and PERL_MB_OPT have the following values, which do not appear to be incorrect:

PERL_MB_OPT="--install_base /X"
PERL_MM_OPT="INSTALL_BASE=/X"

I have Perl installed within a conda environment. I suspect the problem is that CPAN and CPANM are making improper assumptions about the subdirectory structure underneath the paths contained in PERL_MB_OPT and PERL_MM_OPT.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!