PyCrypto 无法在 Windows Server 2008 上加载 mod_wsgi

发布于 2025-01-04 14:42:09 字数 1077 浏览 0 评论 0原文

我在 Windows 2008 Server 64 位上设置了一个项目,使用 Apache 2.2、mod_wsgi 3.3、django 1.2 和 python 2.7(32 位)。

我已经使用 VoidSpace 上找到的安装程序安装了 PyCrypto 2.3(适用于 32 位 python 2.7): http://www.voidspace.org.uk/python/modules.shtml# pycrypto

当我尝试通过解释器导入 PyCrypto 模块时,它工作得很好。然后,我使用以下命令运行 Django 服务器:manage.py runserver

这也按预期执行,CSS 和其他静态图像无法正常显示,但站点运行正常。

当使用 mod_wsgi 和 Apache 时,我收到导入错误,并提示 DLL 加载失败。

完整的堆栈跟踪已发布在pastebin上: http://pastebin.com/hav7sqB0

我使用 DependencyWalker 来查看可能缺少哪些依赖项,并下载了所有似乎丢失的 DLL。然后将它们复制到 System32 windows 目录和 SysWOW64 目录。

DependencyWalker 应用程序现在仅显示“延迟”依赖项错误,但不会阻止功能。

我确实看到了相关问题: 为什么不使用 MSVC 构建 Python DLL使用 mod_wsgi 加载?

但是,正如我之前所说,使用 VoidSpace 安装程序进行安装并不能解决问题。

我尝试使用 MinGW32 进行编译,但收到错误消息,指出它不知道如何在“nt”操作系统上进行编译。

I have a project set up on Windows 2008 Server 64-bit, with Apache 2.2, mod_wsgi 3.3, django 1.2, and python 2.7 (32-bit).

I have installed PyCrypto 2.3 (for 32-bit python 2.7) using the installer found on VoidSpace:
http://www.voidspace.org.uk/python/modules.shtml#pycrypto

When I attempt to import the PyCrypto module via the interpreter, it works perfectly. I then run the Django server using: manage.py runserver

This also is performing as expected, the CSS and other static images do not show properly, but the site is working properly.

When using mod_wsgi and Apache I instead get a import error, and a note that the DLL's failed to load.

The full stacktrace has been posted on pastebin:
http://pastebin.com/hav7sqB0

I used DependencyWalker to see what dependencies that may be missing, and downloaded all of the DLL's that appeared to be missing. Those were then copied to both the System32 windows directory, and SysWOW64 directories.

The DependencyWalker app now shows only "Delayed" dependency errors, but nothing to block functionality.

I did see the related issue:
Why do no Python DLLs built with MSVC load with mod_wsgi?

However, as I stated previously, installing with the VoidSpace installers did NOT resolve the issue.

I have tried compiling with MinGW32, and I am getting the error stating that it does not know how to compile on the "nt" operating system.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

秋风の叶未落 2025-01-11 14:42:09

尝试这种向 Apache 添加新清单的方法。

http://groups.google.com/group/modwsgi/msg/afb025dc949c7051

Try this method of adding a new manifest to Apache.

http://groups.google.com/group/modwsgi/msg/afb025dc949c7051

写下不归期 2025-01-11 14:42:09

pyodbc 也有同样的问题。

  1. 抢夺资源的黑客:
    http://www.angusj.com/resourcehacker/

  2. 用它来查找并复制python27/python.exe 中对 MSVCR90 的依赖(在树 24/1 下):

    ;
        < assemblyIdentity type =“win32”名称=“ Microsoft.VC90.CRT”版本=“ 9.0.21022.8”processorArchitecture =“ x86” publicKeyToken =“ 1fc8b3b9a1e18e3b”>  
    
    
  3. 使用 Resource Hacker 打开 pyodbc.pyd 并将其粘贴到树中(在树 24/2 下):

Had the same issue with pyodbc.

  1. Grabbed Resource Hacker:
    http://www.angusj.com/resourcehacker/

  2. Used it to find and copy the dependency on MSVCR90 in python27/python.exe (under tree 24/1):

    <dependentAssembly>
        <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="x86" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity> 
    </dependentAssembly>
    
  3. Opened up pyodbc.pyd with Resource Hacker and pasted it into the tree (under tree 24/2):

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文