1

我需要能够运行该命令latexindent,但每次都会收到此错误:

Unknown PerlIO layer 'encoding' at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 21.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 126.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 134.
Unknown PerlIO layer "encoding" at /opt/homebrew/Cellar/perl/5.34.0/lib/perl5/5.34.0/open.pm line 135.
Attempt to reload PerlIO/encoding.pm aborted.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/FileExtension.pm line 20.
Compilation failed in require at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/texmf-dist/scripts/latexindent/LatexIndent/Document.pm line 29.
Compilation failed in require at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.
BEGIN failed--compilation aborted at /usr/local/texlive/2021/bin/universal-darwin/latexindent line 27.

我通过这个命令用 Homebrew 安装了 MacTeX brew install --cask mactex。当我键入命令which latexindent时,它给出了这个/usr/local/texlive/2021/bin/universal-darwin/latexindent。我有 Perl v5.34.0,它就在这里/opt/homebrew/bin/perl

如何设置 PerlIO 的编码?

4

1 回答 1

1

基于这个问题,我找到了解决我的问题的方法,如下所示:

  1. 我删除了 : ~/perl5, ~/.cpan, ~/.cpanm;
  2. 我重新启动了计算机;
  3. 然后我Log::Log4perl用命令安装cpan install Log::Log4perl。它问我是否要选择自动或手动配置模式。我选择了自动模式;
  4. 然后我根据这篇文章安装了其他模块: SQL::Statement, Text::CSV_XS, DBD::CSV, Log::Dispatch::File, cpan install YAML::Tiny, File::HomeDir, Unicode::GCString, Mac::SystemDirectory;

最后,该命令latexindent --version给了我版本3.9.1, 2021-03-21并且它可以工作。

于 2021-12-18T23:01:09.317 回答