找到正确版本的 Perl 库函数 List::Util
find correct version of Perl library function List::Util
MaxMind GeoIP 在 Mojave 上工作,从 Perl 调用。
我尝试将我的 macOS 安装从 Perl 5.26 升级到 5.30。
使用MacPorts安装并激活5.30,然后
使用 CPAN 安装 Perl 模块。
几个端口在尝试安装时出错。我不得不强迫他们。
- GeoIP2::数据库::Reader (2.006002)
- MaxMind::DB::Reader (1.000014)
- NetAddr::IP (4.079)
尝试了一下,但失败了,因为 Perl 模块被降级了。
[thvv 库]$ ipcity
Could not find a suitable MaxMind::DB::Reader implementation: List::Util version 1.56 required--this is only version 1.5 at /opt/local/lib/perl5/site_perl/5.30/List/AllUtils.pm line 8.
在 CPAN 中,我尝试安装 List::Util。它说版本 1.56 已经安装。
cpan[4]> i List::Util
Module id = List::Util
CPAN_USERID PEVANS (Paul Evans <leonerd@leonerd.org.uk>)
CPAN_VERSION 1.56
CPAN_FILE P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz
MANPAGE List::Util - A selection of general-utility list subroutines
INST_FILE /opt/local/lib/perl5/site_perl/5.30/darwin-thread-multi-2level/List/Util.pm
INST_VERSION 1.56
我的环境都指向 Perl 版本 5.30
perl --version
This is perl 5, version 30, subversion 3 (v5.30.3) built for darwin-thread-multi-2level
env | grep 5.30
PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.30
PERL_MB_OPT=--install_base "/opt/local/lib/perl5/5.30"
PERL_LOCAL_LIB_ROOT=/opt/local/lib/perl5/5.30
PERL_MM_OPT=INSTALL_BASE=/opt/local/lib/perl5/5.30
如何让 List::AllUtils 找到已安装的 List::Util 版本?
(2021 年 7 月 23 日,星期五)按要求添加信息:
[thvv lib]$ head -1 ~/bin/ipcity
#!/usr/local/bin/perl -I/usr/home/thvv/bin
--(在没有 -I 子句的情况下尝试并得到相同的输出)
[thvv bin]$ perl -MList::Util=999 -e1
List::Util version 999 required--this is only version 1.5 at /opt/local/lib/perl5/5.30/Exporter/Heavy.pm line 125.
BEGIN failed--compilation aborted.
--- 在我的文件系统中查找模块
[thvv bin]$ ls -l /opt/local/lib/perl5/5.30//darwin-thread-multi-2level/List/
total 16
-r--r--r--+ 1 root admin 21126 Jul 1 06:52 Util.pm
drwxr-xr-x+ 3 root admin 96 Jul 18 12:05 Util/
[thvv bin]$ ls -l /opt/local/lib/perl5/5.30//darwin-thread-multi-2level/List/Util
total 0
-r--r--r--+ 1 root admin 1018 Jul 1 06:52 XS.pm
--- 我还调用了 cpan 并做了 'force install List::Util'
Running install for module 'List::Util'
Fetching with LWP:
http://www.cpan.org/authors/id/P/PE/PEVANS/CHECKSUMS
Checksum for /var/root/.cpan/sources/authors/id/P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz ok
Scanning cache /var/root/.cpan/build for sizes
............................................................................DONE
Configuring P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for List::Util
Writing MYMETA.yml and MYMETA.json
PEVANS/Scalar-List-Utils-1.56.tar.gz
/opt/local/bin/perl5.30 Makefile.PL -- OK
Running make for P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz
cp lib/Sub/Util.pm blib/lib/Sub/Util.pm
cp lib/List/Util.pm blib/lib/List/Util.pm
cp lib/List/Util/XS.pm blib/lib/List/Util/XS.pm
cp lib/Scalar/Util.pm blib/lib/Scalar/Util.pm
Running Mkbootstrap for Util ()
chmod 644 "Util.bs"
"/opt/local/bin/perl5.30" -MExtUtils::Command::MM -e 'cp_nonempty' -- Util.bs blib/arch/auto/List/Util/Util.bs 644
"/opt/local/bin/perl5.30" "/opt/local/lib/perl5/5.30/ExtUtils/xsubpp" -typemap '/opt/local/lib/perl5/5.30/ExtUtils/typemap' ListUtil.xs > ListUtil.xsc
mv ListUtil.xsc ListUtil.c
/usr/bin/cc -c -fno-common -DPERL_DARWIN -pipe -Os -fno-strict-aliasing -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -O3 -DVERSION=\"1.56\" -DXS_VERSION=\"1.56\" "-I/opt/local/lib/perl5/5.30/darwin-thread-multi-2level/CORE" -DPERL_EXT -DUSE_PPPORT_H ListUtil.c
rm -f blib/arch/auto/List/Util/Util.bundle
/usr/bin/cc -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -fstack-protector-strong ListUtil.o -o blib/arch/auto/List/Util/Util.bundle \
\
chmod 755 blib/arch/auto/List/Util/Util.bundle
Manifying 4 pod documents
PEVANS/Scalar-List-Utils-1.56.tar.gz
/usr/bin/make -- OK
Running make test for PEVANS/Scalar-List-Utils-1.56.tar.gz
"/opt/local/bin/perl5.30" -MExtUtils::Command::MM -e 'cp_nonempty' -- Util.bs blib/arch/auto/List/Util/Util.bs 644
PERL_DL_NONLAZY=1 "/opt/local/bin/perl5.30" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00version.t ......... ok
t/any-all.t ........... ok
t/blessed.t ........... ok
t/dualvar.t ........... ok
t/exotic_names.t ...... ok
t/first.t ............. ok
t/getmagic-once.t ..... ok
t/head-tail.t ......... ok
t/isvstring.t ......... ok
t/lln.t ............... ok
t/max.t ............... ok
t/maxstr.t ............ ok
t/mesh.t .............. ok
t/min.t ............... ok
t/minstr.t ............ ok
t/openhan.t ........... ok
t/pair.t .............. ok
t/product.t ........... ok
t/prototype.t ......... ok
t/readonly.t .......... ok
t/reduce.t ............ ok
t/reductions.t ........ ok
t/refaddr.t ........... ok
t/reftype.t ........... ok
t/rt-96343.t .......... ok
t/sample.t ............ ok
t/scalarutil-proto.t .. ok
t/shuffle.t ........... ok
t/stack-corruption.t .. ok
t/subname.t ........... ok
t/sum.t ............... ok
t/sum0.t .............. ok
t/tainted.t ........... ok
t/uniq.t .............. ok
t/uniqnum.t ........... ok
t/weak.t .............. ok
t/zip.t ............... ok
All tests successful.
Files=37, Tests=2144, 4 wallclock secs ( 0.24 usr 0.10 sys + 2.88 cusr 0.42 csys = 3.64 CPU)
Result: PASS
Lockfile removed.
PEVANS/Scalar-List-Utils-1.56.tar.gz
/usr/bin/make test -- OK
Running make install for PEVANS/Scalar-List-Utils-1.56.tar.gz
"/opt/local/bin/perl5.30" -MExtUtils::Command::MM -e 'cp_nonempty' -- Util.bs blib/arch/auto/List/Util/Util.bs 644
Manifying 4 pod documents
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Appending installation info to /opt/local/lib/perl5/5.30/darwin-thread-multi-2level/perllocal.pod
PEVANS/Scalar-List-Utils-1.56.tar.gz
/usr/bin/make install -- OK
(2021 年 7 月 23 日,更多)
[thvv bin]$ which perl
/opt/local/bin/perl
[thvv bin]$ ls -l /opt/local/bin/perl
lrwxr-xr-x 1 root wheel 8 Jul 21 12:28 /opt/local/bin/perl@ -> perl5.30
[thvv bin]$ file `which perl`
/opt/local/bin/perl: Mach-O 64-bit executable x86_64
(美国东部时间 2021 年 7 月 23 日 12:59)尝试查看 /opt/local/lib/perl5/5.30//darwin-thread-multi-2level/List/Util/XS.pm
这似乎是 1.5 的来源。
强制安装,没有变化
package List::Util::XS;
use strict;
use warnings;
use List::Util;
our $VERSION = "1.50"; # FIXUP
$VERSION = eval $VERSION; # FIXUP
1;
[snipped pod]
我尝试编辑 /opt/local/lib/perl5/site_perl/5.30/List/AllUtils.pm 以将 1.50 更改为 1.56。为了运气重新启动机器。 List/AllUtils.pm 第 8 行仍然失败,说当前版本是 1.50.
(2021 年 7 月 24 日 08:13 美国东部时间)根据@ikegami
的要求
[thvv@Uly2 ~]$ echo 'o conf' | cpan | grep 'make\|mbuild'; set | grep ^PERL
make [/usr/bin/make]
make_arg []
make_install_arg []
make_install_make_command [sudo /usr/bin/make]
makepl_arg []
mbuild_arg []
mbuild_install_arg []
mbuild_install_build_command [sudo ./Build]
mbuildpl_arg []
PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.30
PERL_LOCAL_LIB_ROOT=/opt/local/lib/perl5/5.30
PERL_MB_OPT='--install_base "/opt/local/lib/perl5/5.30"'
PERL_MM_OPT=INSTALL_BASE=/opt/local/lib/perl5/5.30
好的,我删除了 Perl 5.30,安装了 5.34,重新加载了我的 Perl 模块。
还是失败了。
Could not find a suitable MaxMind::DB::Reader implementation: List::Util version 1.56 required--this is only version 1.55 at /opt/local/lib/perl5/site_perl/5.34/List/AllUtils.pm line 8.
BEGIN failed--compilation aborted at /opt/local/lib/perl5/site_perl/5.34/List/AllUtils.pm line 8.
List::AllUtils 中失败的“使用”行查找 List::Util 版本 1.56。 List::Util 的 .pm 文件位于
/opt/local/lib/perl5/site_perl/5.34/darwin-thread-multi-2level/List/Util.pm
和电话
XSLoader::load('List::Util', $XS_VERSION)
版本 1.56。这反过来又试图调用
/opt/local/lib/perl5/site_perl/5.34/darwin-thread-multi-2level/auto/List/Util/Util.捆绑
这是一个 Mac 二进制文件。看来 XSLoader 还没有加载 List::Util.
的二进制版本
啊哈。我看到 /opt/local/lib/perl5/5.34 和 /opt/local/lib/perl5/site_perl/5.34 是具有不同内容的不同目录。我用 CPAN 加载的文件进入 site_perl/5.34。但是 List::Util 在 5.34 中。
只有一个程序在两个目录之间有实质性的代码更改。
那么,在 Mac 上,我是否应该将 /opt/local/lib/perl5/site_perl/5.34/ 更改为 /opt/local/lib/perl5/5.34/ 的符号链接?
ipcity
使用 /usr/local/bin/perl
,它是 /opt/local/bin/perl
的符号链接。这是路径中找到的第一个 perl
。如果我们检查 cpan
的 shebang,我们会发现引用了相同的 perl
(安装尝试的输出证明了这一点)。您可能安装了不止一个 Perl,但这里只涉及一个。因此,问题不是为错误的 perl
.
安装 List::Util
正在加载 List::Util 加载版本显示已加载版本 1.5。但是安装了 1.56 版。这意味着该模块安装在非标准位置,但 perl
未被告知查看该位置。
您的环境通知模块安装程序 ExtUtils::MakeMaker 和 Module::Build 在 /opt/local/lib/perl5/5.30
下安装模块。具体来说,它会通知安装程序将 .pm 文件安装到 /opt/local/lib/perl5/5.30/lib/perl5
(或相应的 arch 目录),但不会告诉 perl
在该目录中查找;它被告知要查看 /opt/local/lib/perl5/5.30
。这是错误的,也是问题的关键。
修复 PERL5LIB
.
也就是说,设置 PERL_MB_OPT
没有意义
和 PERL_MM_OPT
在 /opt
中使用 perl
时。你的默认安装路径perl
你应该已经懂了。你可以看到他们在用什么
perl -V:'.*inst.*'
最后,如果PERL_MB_OPT
和 PERL_MM_OPT
没有设置,设置 PERL5LIB
或 PERL_LOCAL_LIB_ROOT
也没有意义。
我怀疑您应该取消设置所有这四个变量。
MaxMind GeoIP 在 Mojave 上工作,从 Perl 调用。
我尝试将我的 macOS 安装从 Perl 5.26 升级到 5.30。
使用MacPorts安装并激活5.30,然后
使用 CPAN 安装 Perl 模块。
几个端口在尝试安装时出错。我不得不强迫他们。
- GeoIP2::数据库::Reader (2.006002)
- MaxMind::DB::Reader (1.000014)
- NetAddr::IP (4.079)
尝试了一下,但失败了,因为 Perl 模块被降级了。
[thvv 库]$ ipcity
Could not find a suitable MaxMind::DB::Reader implementation: List::Util version 1.56 required--this is only version 1.5 at /opt/local/lib/perl5/site_perl/5.30/List/AllUtils.pm line 8.
在 CPAN 中,我尝试安装 List::Util。它说版本 1.56 已经安装。
cpan[4]> i List::Util
Module id = List::Util
CPAN_USERID PEVANS (Paul Evans <leonerd@leonerd.org.uk>)
CPAN_VERSION 1.56
CPAN_FILE P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz
MANPAGE List::Util - A selection of general-utility list subroutines
INST_FILE /opt/local/lib/perl5/site_perl/5.30/darwin-thread-multi-2level/List/Util.pm
INST_VERSION 1.56
我的环境都指向 Perl 版本 5.30
perl --version
This is perl 5, version 30, subversion 3 (v5.30.3) built for darwin-thread-multi-2level
env | grep 5.30
PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.30
PERL_MB_OPT=--install_base "/opt/local/lib/perl5/5.30"
PERL_LOCAL_LIB_ROOT=/opt/local/lib/perl5/5.30
PERL_MM_OPT=INSTALL_BASE=/opt/local/lib/perl5/5.30
如何让 List::AllUtils 找到已安装的 List::Util 版本?
(2021 年 7 月 23 日,星期五)按要求添加信息:
[thvv lib]$ head -1 ~/bin/ipcity
#!/usr/local/bin/perl -I/usr/home/thvv/bin
--(在没有 -I 子句的情况下尝试并得到相同的输出)
[thvv bin]$ perl -MList::Util=999 -e1
List::Util version 999 required--this is only version 1.5 at /opt/local/lib/perl5/5.30/Exporter/Heavy.pm line 125.
BEGIN failed--compilation aborted.
--- 在我的文件系统中查找模块
[thvv bin]$ ls -l /opt/local/lib/perl5/5.30//darwin-thread-multi-2level/List/
total 16
-r--r--r--+ 1 root admin 21126 Jul 1 06:52 Util.pm
drwxr-xr-x+ 3 root admin 96 Jul 18 12:05 Util/
[thvv bin]$ ls -l /opt/local/lib/perl5/5.30//darwin-thread-multi-2level/List/Util
total 0
-r--r--r--+ 1 root admin 1018 Jul 1 06:52 XS.pm
--- 我还调用了 cpan 并做了 'force install List::Util'
Running install for module 'List::Util'
Fetching with LWP:
http://www.cpan.org/authors/id/P/PE/PEVANS/CHECKSUMS
Checksum for /var/root/.cpan/sources/authors/id/P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz ok
Scanning cache /var/root/.cpan/build for sizes
............................................................................DONE
Configuring P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz with Makefile.PL
Checking if your kit is complete...
Looks good
Generating a Unix-style Makefile
Writing Makefile for List::Util
Writing MYMETA.yml and MYMETA.json
PEVANS/Scalar-List-Utils-1.56.tar.gz
/opt/local/bin/perl5.30 Makefile.PL -- OK
Running make for P/PE/PEVANS/Scalar-List-Utils-1.56.tar.gz
cp lib/Sub/Util.pm blib/lib/Sub/Util.pm
cp lib/List/Util.pm blib/lib/List/Util.pm
cp lib/List/Util/XS.pm blib/lib/List/Util/XS.pm
cp lib/Scalar/Util.pm blib/lib/Scalar/Util.pm
Running Mkbootstrap for Util ()
chmod 644 "Util.bs"
"/opt/local/bin/perl5.30" -MExtUtils::Command::MM -e 'cp_nonempty' -- Util.bs blib/arch/auto/List/Util/Util.bs 644
"/opt/local/bin/perl5.30" "/opt/local/lib/perl5/5.30/ExtUtils/xsubpp" -typemap '/opt/local/lib/perl5/5.30/ExtUtils/typemap' ListUtil.xs > ListUtil.xsc
mv ListUtil.xsc ListUtil.c
/usr/bin/cc -c -fno-common -DPERL_DARWIN -pipe -Os -fno-strict-aliasing -fstack-protector-strong -I/opt/local/include -DPERL_USE_SAFE_PUTENV -Wno-error=implicit-function-declaration -O3 -DVERSION=\"1.56\" -DXS_VERSION=\"1.56\" "-I/opt/local/lib/perl5/5.30/darwin-thread-multi-2level/CORE" -DPERL_EXT -DUSE_PPPORT_H ListUtil.c
rm -f blib/arch/auto/List/Util/Util.bundle
/usr/bin/cc -bundle -undefined dynamic_lookup -L/opt/local/lib -Wl,-headerpad_max_install_names -fstack-protector-strong ListUtil.o -o blib/arch/auto/List/Util/Util.bundle \
\
chmod 755 blib/arch/auto/List/Util/Util.bundle
Manifying 4 pod documents
PEVANS/Scalar-List-Utils-1.56.tar.gz
/usr/bin/make -- OK
Running make test for PEVANS/Scalar-List-Utils-1.56.tar.gz
"/opt/local/bin/perl5.30" -MExtUtils::Command::MM -e 'cp_nonempty' -- Util.bs blib/arch/auto/List/Util/Util.bs 644
PERL_DL_NONLAZY=1 "/opt/local/bin/perl5.30" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/00version.t ......... ok
t/any-all.t ........... ok
t/blessed.t ........... ok
t/dualvar.t ........... ok
t/exotic_names.t ...... ok
t/first.t ............. ok
t/getmagic-once.t ..... ok
t/head-tail.t ......... ok
t/isvstring.t ......... ok
t/lln.t ............... ok
t/max.t ............... ok
t/maxstr.t ............ ok
t/mesh.t .............. ok
t/min.t ............... ok
t/minstr.t ............ ok
t/openhan.t ........... ok
t/pair.t .............. ok
t/product.t ........... ok
t/prototype.t ......... ok
t/readonly.t .......... ok
t/reduce.t ............ ok
t/reductions.t ........ ok
t/refaddr.t ........... ok
t/reftype.t ........... ok
t/rt-96343.t .......... ok
t/sample.t ............ ok
t/scalarutil-proto.t .. ok
t/shuffle.t ........... ok
t/stack-corruption.t .. ok
t/subname.t ........... ok
t/sum.t ............... ok
t/sum0.t .............. ok
t/tainted.t ........... ok
t/uniq.t .............. ok
t/uniqnum.t ........... ok
t/weak.t .............. ok
t/zip.t ............... ok
All tests successful.
Files=37, Tests=2144, 4 wallclock secs ( 0.24 usr 0.10 sys + 2.88 cusr 0.42 csys = 3.64 CPU)
Result: PASS
Lockfile removed.
PEVANS/Scalar-List-Utils-1.56.tar.gz
/usr/bin/make test -- OK
Running make install for PEVANS/Scalar-List-Utils-1.56.tar.gz
"/opt/local/bin/perl5.30" -MExtUtils::Command::MM -e 'cp_nonempty' -- Util.bs blib/arch/auto/List/Util/Util.bs 644
Manifying 4 pod documents
Files found in blib/arch: installing files in blib/lib into architecture dependent library tree
Appending installation info to /opt/local/lib/perl5/5.30/darwin-thread-multi-2level/perllocal.pod
PEVANS/Scalar-List-Utils-1.56.tar.gz
/usr/bin/make install -- OK
(2021 年 7 月 23 日,更多)
[thvv bin]$ which perl
/opt/local/bin/perl
[thvv bin]$ ls -l /opt/local/bin/perl
lrwxr-xr-x 1 root wheel 8 Jul 21 12:28 /opt/local/bin/perl@ -> perl5.30
[thvv bin]$ file `which perl`
/opt/local/bin/perl: Mach-O 64-bit executable x86_64
(美国东部时间 2021 年 7 月 23 日 12:59)尝试查看 /opt/local/lib/perl5/5.30//darwin-thread-multi-2level/List/Util/XS.pm 这似乎是 1.5 的来源。
强制安装,没有变化
package List::Util::XS;
use strict;
use warnings;
use List::Util;
our $VERSION = "1.50"; # FIXUP
$VERSION = eval $VERSION; # FIXUP
1;
[snipped pod]
我尝试编辑 /opt/local/lib/perl5/site_perl/5.30/List/AllUtils.pm 以将 1.50 更改为 1.56。为了运气重新启动机器。 List/AllUtils.pm 第 8 行仍然失败,说当前版本是 1.50.
(2021 年 7 月 24 日 08:13 美国东部时间)根据@ikegami
的要求[thvv@Uly2 ~]$ echo 'o conf' | cpan | grep 'make\|mbuild'; set | grep ^PERL
make [/usr/bin/make]
make_arg []
make_install_arg []
make_install_make_command [sudo /usr/bin/make]
makepl_arg []
mbuild_arg []
mbuild_install_arg []
mbuild_install_build_command [sudo ./Build]
mbuildpl_arg []
PERL5LIB=/Users/thvv/bin:/opt/local/lib/perl5/5.30
PERL_LOCAL_LIB_ROOT=/opt/local/lib/perl5/5.30
PERL_MB_OPT='--install_base "/opt/local/lib/perl5/5.30"'
PERL_MM_OPT=INSTALL_BASE=/opt/local/lib/perl5/5.30
好的,我删除了 Perl 5.30,安装了 5.34,重新加载了我的 Perl 模块。 还是失败了。
Could not find a suitable MaxMind::DB::Reader implementation: List::Util version 1.56 required--this is only version 1.55 at /opt/local/lib/perl5/site_perl/5.34/List/AllUtils.pm line 8.
BEGIN failed--compilation aborted at /opt/local/lib/perl5/site_perl/5.34/List/AllUtils.pm line 8.
List::AllUtils 中失败的“使用”行查找 List::Util 版本 1.56。 List::Util 的 .pm 文件位于 /opt/local/lib/perl5/site_perl/5.34/darwin-thread-multi-2level/List/Util.pm 和电话 XSLoader::load('List::Util', $XS_VERSION) 版本 1.56。这反过来又试图调用 /opt/local/lib/perl5/site_perl/5.34/darwin-thread-multi-2level/auto/List/Util/Util.捆绑 这是一个 Mac 二进制文件。看来 XSLoader 还没有加载 List::Util.
的二进制版本啊哈。我看到 /opt/local/lib/perl5/5.34 和 /opt/local/lib/perl5/site_perl/5.34 是具有不同内容的不同目录。我用 CPAN 加载的文件进入 site_perl/5.34。但是 List::Util 在 5.34 中。 只有一个程序在两个目录之间有实质性的代码更改。
那么,在 Mac 上,我是否应该将 /opt/local/lib/perl5/site_perl/5.34/ 更改为 /opt/local/lib/perl5/5.34/ 的符号链接?
ipcity
使用 /usr/local/bin/perl
,它是 /opt/local/bin/perl
的符号链接。这是路径中找到的第一个 perl
。如果我们检查 cpan
的 shebang,我们会发现引用了相同的 perl
(安装尝试的输出证明了这一点)。您可能安装了不止一个 Perl,但这里只涉及一个。因此,问题不是为错误的 perl
.
正在加载 List::Util 加载版本显示已加载版本 1.5。但是安装了 1.56 版。这意味着该模块安装在非标准位置,但 perl
未被告知查看该位置。
您的环境通知模块安装程序 ExtUtils::MakeMaker 和 Module::Build 在 /opt/local/lib/perl5/5.30
下安装模块。具体来说,它会通知安装程序将 .pm 文件安装到 /opt/local/lib/perl5/5.30/lib/perl5
(或相应的 arch 目录),但不会告诉 perl
在该目录中查找;它被告知要查看 /opt/local/lib/perl5/5.30
。这是错误的,也是问题的关键。
修复 PERL5LIB
.
也就是说,设置 PERL_MB_OPT
没有意义
和 PERL_MM_OPT
在 /opt
中使用 perl
时。你的默认安装路径perl
你应该已经懂了。你可以看到他们在用什么
perl -V:'.*inst.*'
最后,如果PERL_MB_OPT
和 PERL_MM_OPT
没有设置,设置 PERL5LIB
或 PERL_LOCAL_LIB_ROOT
也没有意义。
我怀疑您应该取消设置所有这四个变量。