【问题标题】:Use perl WWW:Mechanize on MacOS Big Sur在 MacOS Big Sur 上使用 perl WWW:Mechanize
【发布时间】:2021-09-07 02:59:22
【问题描述】:

我想在 BigSur 上使用 WWW:Mechanize 和 perl。 我的 Perl:

    perl 5, version 34, subversion 0 (v5.34.0)

就使用模块而言,我可以安装 perl:

    DBI; 
    LWP::UserAgent; 
    LWP::Simple qw /get/; 
    HTML::TreeBuilder; 
    HTML::Parser;URI qw();

尝试使用
WWW:: Mechanize;

失败:

    Can't locate WWW/Mechanize.pm in @INC (you may need to install the WWW::Mechanize module)
@INC contains: 
/usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0/darwin-thread-multi-2level 
/usr/local/Cellar/perl/5.34.0/lib/perl5/site_perl/5.34.0
/usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0/darwin-thread-multi-2level 
/usr/local/Cellar/perl/5.34.0/lib/perl5/5.34.0 
/usr/local/lib/perl5/site_perl/5.34.0)

我尝试加载 WWW:Mechanize with

sudo cpanm WWW::Mechanize

答案是:

WWW::Mechanize 是最新的。 (2.03)

但是 BBEdit 仍然没有看到 WWW::Mechanize。

我怎样才能做到这一点?

【问题讨论】:

  • 似乎您正在使用 Homebrew perl。可能与系统 perl 有冲突。你是如何安装cpanm 的? which cpanm 的输出是什么?您是否也使用cpanm 安装了其他模块?

标签: perl cpan macos-big-sur www-mechanize


【解决方案1】:

尝试使用自制软件perl附带的cpan安装模块:

% /usr/local/Cellar/perl/5.34.0/bin/cpan WWW::Mechanize

并且,为了帮助我们回答您的问题:

  • 给我们which cpanm 的输出和该文件的第一行以查看shebang。
  • 你能用自制软件perl 加载其他模块吗?您可能已将它们安装到不同的位置。
#!/usr/local/Cellar/perl/5.34.0/bin/perl
use DBI; 
use LWP::UserAgent; 
use LWP::Simple qw /get/; 
use HTML::TreeBuilder; 
use HTML::Parser;
use URI qw(); 

【讨论】:

  • 哪个cpanm:/usr/local/bin/cpanm
猜你喜欢
  • 2021-06-19
  • 2021-08-04
  • 2021-05-31
  • 2021-06-08
  • 2021-03-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-29
相关资源
最近更新 更多