Mercurial CGI (hgweb.cgi) 失败

10 投票
2 回答
2353 浏览
提问于 2025-04-16 13:46

我在虚拟机上安装了Mercurial 1.8.1和Python 2.6.6,系统是Windows 2008 R2。我尝试过用msi安装、从源代码安装以及使用tortoisehg。命令行的Hg运行得很好,但当我运行hgweb.cgi时,还是出现了同样的错误:

Traceback (most recent call last):
  File ".\hgweb.cgi", line 17, in 
    application = hgweb(config)
  File "mercurial\hgweb\__init__.pyc", line 26, in hgweb

  File "mercurial\hgweb\hgwebdir_mod.pyc", line 61, in __init__

  File "mercurial\hgweb\hgwebdir_mod.pyc", line 70, in refresh

  File "mercurial\ui.pyc", line 35, in __init__

  File "mercurial\demandimport.pyc", line 75, in __getattribute__

  File "mercurial\demandimport.pyc", line 47, in _load

  File "mercurial\util.pyc", line 576, in 

  File "mercurial\demandimport.pyc", line 85, in _demandimport

  File "mercurial\windows.pyc", line 21, in 

  File "mercurial\demandimport.pyc", line 75, in __getattribute__

  File "mercurial\demandimport.pyc", line 47, in _load

  File "mercurial\osutil.pyc", line 12, in 

  File "mercurial\osutil.pyc", line 10, in __load

ImportError: DLL load failed: The specified module could not be found.

我在StackOverflow和其他地方找到的其他答案建议我尝试从源代码安装,把纯osutil放到安装目录里,或者安装一个旧版本。我都试过了。

这让我特别沮丧,因为我还有其他类似的非虚拟机机器运行得很好,但我就是找不到问题所在。

有什么想法吗?

2 个回答

1

每当我遇到那些不太清楚的错误信息,虽然知道系统出了点问题,但不知道具体是什么,我就会使用Sysinternals的Procmon工具来查看注册表和文件系统的情况。这个工具信息量很大,想要设置过滤器只显示我关心的进程需要一些学习,但你可以把结果导出到Excel里,快速浏览一下有没有可疑的结果。当然,特别要注意那些失败的情况。

试试看,看看系统在找哪个DLL文件。

18

我遇到了同样的错误,使用的系统配置如下:

  • 安装了Python-2.6.6,使用的是msi安装包
  • 安装了mercurial-1.8.2-x86,也是用msi安装包
  • 使用的是IIS7

我简单地解决了这个问题:

  1. 首先,Python是早就安装好的
  2. 卸载了Mercurial的msi安装包
  3. mercurial官网下载并安装标记为"推荐用于hgweb设置"的“Mercurial-1.8.2(32位 py2.6)”安装包。
  4. 把C:\Python26\Lib\site-packages\mercurial\里的内容复制到IIS7网站设置中使用的目录。

到现在为止,一切都正常工作。希望这能帮到你。

撰写回答