Python 导入错误“DLL 加载失败” | Python
我在 IIS6 Web 服务器后面提供 Django 应用程序。
测试服务器运行完美,但是当在 Web 服务器后面运行时,模块无法导入,我收到此错误:
加载pyodbc模块时出错:DLL加载失败:找不到指定的模块
只是为了记录,该模块是 pyodbc
该网站使用 isapi-wsgi 通过 isapi 提供服务
有什么想法吗?这真的会让我很开心! :)
I'm serving a Django app behind IIS6 web server.
The test server runs perfectly, but when running behind the web server a module failes to import I get this error:
Error loading pyodbc module: DLL load failed: The specified module could not be found
Just for the record the module is pyodbc
The site is served though isapi by using isapi-wsgi
Any ideas? It would really make my day! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
这个错误是一个 PITA:它通常是由于 dll 中缺少符号引起的(因为找不到依赖的 dll,等等......)。您应该使用 dependency walker 检查 .pyd,或者查看 Windows 日志,它可能会根据您的配置记录此类错误。
This error is a PITA: it is often caused by missing symbols in dll (because a dependent dll was not found, etc...). You should check the .pyd with dependency walker, or look into the windows log which may log such errors depending on your configuration.
我最近一直在努力在 Windows 2008 上的 IIS 7 上使用 MS SQL 2008 设置 Django/Python。我遇到了与您相同的问题。我使用的是 PyODBC-2.1.8。我从源代码编译了模块。我使用 mingw 编译器从源代码编译它们。什么都没起作用。
然后我降级到 PyODBC-2.1.7。它成功了!我使用了 Python 2.6 发行版网站上提供的二进制文件(即我正在使用的 Python 版本)。
我希望这会有所帮助。
I have recently been battling with setting up Django/Python on IIS 7 on Windows 2008 with MS SQL 2008. I bumped into the same problem as you did. I was using PyODBC-2.1.8. I compiled the modules from source. I used the
mingw
compiler to compile them from source. Nothing worked.I then downgraded to PyODBC-2.1.7. And it worked! I used the binary available from the site for the Python 2.6 distribution (that is the version of Python I am using).
I hope this may help.
就我而言,我在 32 位操作系统上安装了 64 位的 pyodbc。这两个版本都可以在此处提供。
我希望我不是唯一一个愚蠢到这样做的人,这可能会对某人有所帮助。
In my case I had installed pyodbc for 64-bits on a 32-bit OS. Both versions are available here.
I'm hoping I'm not the only one stupid enough to do this and this might help someone.
从以下链接下载最新的“Microsoft Visual C++ Redistributable for Visual Studio 2015、2017 和 2019”:
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads
dowload the latest "Microsoft Visual C++ Redistributable for Visual Studio 2015, 2017 and 2019" from the links at
https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads