python - 在 IIS7 64 位上安装 Mercurial 时出错 : "DLL Load Failed: %1 is not a valid Win32 application"

标签 python windows iis-7 mercurial installation

我正在使用本指南在 IIS7 网络服务器上安装 Mercurial:http://pteradigm.com/2012/09/16/mercurial-on-iis-7-x86-or-x64/#hg_iis_python

我正在使用以下版本:

  • python-2.7.6.amd64
  • pywin32-218.win-amd64-py2.7
  • mercurial-2.8.2.tar
  • Windows Server 2008 R2

我已将 python 和 python\scripts 文件夹添加到“Path”环境变量中。

当我需要将 hgwebdir_wsgi.py 编译为 DLL 时,我尝试使用管理命令提示符编译 hgwebdir_wsgi.py 并收到以下错误:

C:\inetpub\wwwroot\hg>python hgwebdir_wsgi.py
Traceback (most recent call last):
  File "hgwebdir_wsgi.py", line 73, in <module>
    application = hgwebdir(hgweb_config)
  File "C:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 89,
 in __init__
    self.refresh()
  File "C:\Python27\lib\site-packages\mercurial\hgweb\hgwebdir_mod.py", line 98,
 in refresh
    u = ui.ui()
  File "C:\Python27\lib\site-packages\mercurial\ui.py", line 45, in __init__
    for f in scmutil.rcpath():
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
  File "C:\Python27\lib\site-packages\mercurial\scmutil.py", line 290, in <modul
e>
    class vfs(abstractvfs):
  File "C:\Python27\lib\site-packages\mercurial\scmutil.py", line 318, in vfs
    @util.propertycache
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
  File "C:\Python27\lib\site-packages\mercurial\util.py", line 27, in <module>
    cachestat = platform.cachestat
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
  File "C:\Python27\lib\site-packages\mercurial\windows.py", line 36, in <module
>
    posixfile.__doc__ = osutil.posixfile.__doc__
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 102, in _
_getattribute__
    self._load()
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 74, in _l
oad
    mod = _hgextimport(_import, head, globals, locals, None, level)
  File "C:\Python27\lib\site-packages\mercurial\demandimport.py", line 43, in _h
gextimport
    return importfunc(name, globals, *args)
ImportError: DLL load failed: %1 is not a valid Win32 application.
大多数相关问题的答案是 32 位与 64 位问题:但是,我使用了 Python 和 Pywin 的 64 位版本,并从源代码构建了 Mercurial(或者正在尝试)。为什么我的编译失败?

最佳答案

我无法解决此版本 Mercurial 的问题。最终的结果是两者兼而有之

  1. 使用稍旧版本的 Mercurial
  2. 全部切换到 32 位。

尽管我之前只小心安装了 64 位版本,但我认为在某个地方添加了 32 位版本 - 至少我是这么认为的,因为 32 位一开始就可以工作。我怀疑旧版本的 Mercurial 是其工作的原因,但我确实更改了版本,因此我将其包含在我的答案中。

我对遇到此问题的其他人的建议:切换到统一的 32 位,无论您的处理器如何。

关于python - 在 IIS7 64 位上安装 Mercurial 时出错 : "DLL Load Failed: %1 is not a valid Win32 application",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21127696/

相关文章:

python - 在 Python 中抓取 javascript 呈现的网站的 "Script part"

asp.net - 如何在 IIS7.0 上解析 "HTTP Error 500.19 - Internal Server Error"

jquery - 通过 Jquery 和 ASP.NET 进行 Ajax

c++ - C++ 的数据库访问库

c++ - Windows:从语言环境字符串获取 LCID?

asp.net - iis7应用程序asp.net 2.0的并发用户限制

python - 在 Python 中调整图像大小

python - csr_matrix 的点积导致段错误

python - Python 的 list.index() 函数,当没有找到时不会抛出异常

windows - 如何测量 for 循环每次迭代所需的时间?