You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Windows系统下安装Perl以支持LaTeX工具latexindent的问题求助

Windows系统下安装Perl以支持LaTeX工具latexindent的问题求助

大家好,我现在在Windows上安装Perl时碰到了棘手的问题——我必须用到Perl来运行LaTeX相关的工具latexindent,但尝试了两种常见的Perl发行版都没能成功,想请大家帮忙出出主意。

尝试1:通过Chocolatey安装StrawberryPerl

一开始我按照LaTeX用户的常用推荐,用Chocolatey安装StrawberryPerl,但卡在了File::Which这个依赖包上,反复尝试都没法解决。安装过程中的错误日志如下:

Fetching http://www.cpan.org/authors/id/R/RE/REHSACK/File-HomeDir-1.006.tar.gz ... OK

Configuring File-HomeDir-1.006 ... OK

==> Found dependencies: File::Which

--> Working on File::Which

Fetching http://www.cpan.org/authors/id/P/PL/PLICEASE/File-Which-1.27.tar.gz ... OK

! Bad archive: File-Which-1.27.tar.gz

! Failed to unpack File-Which-1.27.tar.gz: no directory

! Failed to fetch distribution File-Which-1.27

! Installing the dependencies failed: Module 'File::Which' is not installed

! Bailing out the installation for File-HomeDir-1.006.

我试过更换CPAN镜像,也手动尝试安装这个依赖包,但始终没能绕过这个问题。

尝试2:通过Chocolatey安装ActivePerl

后来我转而去试ActiveState的ActivePerl,结果也出了一堆问题。安装中途就失败了,日志提示是MSI通用错误:

WARNING: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\ActivePerl_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error.

ERROR: Running ["C:\Windows\System32\msiexec.exe" /i "C:\Users\FooBar\AppData\Local\Temp\chocolatey\ActivePerl\5.28.0\ActivePerl-5.28.msi" /quiet TARGETDIR="C:\" PERL_PATH=Yes PERL_EXT=Yes ] was not successful. Exit code was '1603'. Exit code indicates the following: Generic MSI Error. This is a local environment error, not an issue with a package or the MSI itself - it could mean a pending reboot is necessary prior to install or something else (like the same version is already installed). Please see MSI log if available. If not, try again adding '--install-arguments="'/l*v c:\ActivePerl_msi_install.log'"'. Then search the MSI Log for "Return Value 3" and look above that for the error..

Environment Vars (like PATH) have changed. Close/reopen your shell to
see the changes (or in powershell/cmd.exe just type `refreshenv`).

The install of ActivePerl was NOT successful.

Error while running 'C:\ProgramData\chocolatey\lib\ActivePerl\tools\ChocolateyInstall.ps1'.
See log for details.

Chocolatey installed 0/1 packages. 1 packages failed.
See the log for details (C:\ProgramData\chocolatey\logs\chocolatey.log).

Failures
- ActivePerl (exited 1603) - Error while running 'C:\ProgramData\chocolatey\lib\ActivePerl\tools\ChocolateyInstall.ps1'.
See log for details.

更麻烦的是,安装失败后我的系统里(AppData\Local和AppData\Roaming目录)留下了一堆state.exe文件,想删除的时候还一直提示“访问被拒绝”,清理起来特别费劲。

我现在的求助需求:

我不想陷入XY问题(也就是去解决无关的分支问题),我的核心目标是能让Perl正常运行,这样就能用latexindent处理LaTeX项目了。希望大家能给我一些建议,帮我做到以下任意一点:

  • 成功在Windows上安装能支持latexindent的Perl环境
  • 解决StrawberryPerl安装时碰到的File::Which依赖问题
  • 解决ActivePerl的安装错误,以及清理那些删不掉的残留文件

感谢大家的任何经验分享和建议!

备注:内容来源于stack exchange,提问作者Foad

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.20 09:49:28