windows lxml: DLL 加载失败: 找不到指定的模块
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7228229/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
lxml: DLL load failed: The specified module could not be found
提问by Marius Grigaitis
I have Windows Server 2008 R2 x64.
It has running Python27 x86 + Django 1.3 + apache 2.2 x86 under wsgi
. It runs ok without lxml.
我有 Windows Server 2008 R2 x64。它有运行Python27 x86 + Django 1.3 + apache 2.2 x86 under wsgi
。它在没有 lxml 的情况下运行正常。
We're using soaplib, which requires lxml. I tried installing lxml in several ways:
我们正在使用soaplib,它需要lxml。我尝试通过多种方式安装 lxml:
- using easy_install
- downloading win32 installation binary.
- 使用easy_install
- 下载win32安装二进制文件。
Problem is that running under site under apache raises following error:
问题是在 apache 下的站点下运行会引发以下错误:
ImportError at /
DLL load failed: The specified module could not be found.
It raises this error on from lxml import etree
它引发了这个错误 from lxml import etree
I have googled for solution but found nothing useful. Some info I found:
我用谷歌搜索了解决方案,但没有发现任何有用的东西。我找到的一些信息:
- That there was some change in python26->python27 that changes what dlls are included
- I used dependency walker to find which dlls are missing. The ones I found missing are: gpsvc.dll, IEShims.dll, msvcr90.dll. When I tried installing x86 redistributable package but it didn't change anything. I tried copying msvcr90.dll to egg dir of lxml and it created another error that said it coudn't load the dll (I don't remember exact exception but I can generate it if needed)
- python26->python27 中有一些变化,改变了包含的 dll
- 我使用dependency walker来查找缺少哪些dll。我发现丢失的是:gpsvc.dll、IEShims.dll、msvcr90.dll。当我尝试安装 x86 可再发行组件包但它没有改变任何东西时。我尝试将 msvcr90.dll 复制到 lxml 的 egg dir 并且它创建了另一个错误,说它无法加载 dll(我不记得确切的异常,但如果需要我可以生成它)
It works when running from django internal server by running manage.py runserver
它在通过运行从 django 内部服务器运行时工作 manage.py runserver
How can I resolve this issue? Thanks.
我该如何解决这个问题?谢谢。
回答by Marius Grigaitis
I installed unofficial builds from http://www.lfd.uci.edu/~gohlke/pythonlibs/
我从http://www.lfd.uci.edu/~gohlke/pythonlibs/安装了非官方版本
It solved my problem.
它解决了我的问题。
回答by Jerry Chong
I've had this problem as well when attempting to load etree via Windows Scripting Host. After trying different approaches, I came across this Python 3.1 change, which proposes that the new Python modules should no longer embed manifests as it causes distribution problems with no MSVC++ runtimes installed:
我在尝试通过 Windows Scripting Host 加载 etree 时也遇到了这个问题。在尝试了不同的方法后,我发现了这个 Python 3.1 的变化,它建议新的 Python 模块不应再嵌入清单,因为它会导致没有安装 MSVC++ 运行时的分发问题:
So I've simply loaded up %PythonPath%\Lib\site-packages\lxml\etree.pyd in Resource Hacker (http://www.angusj.com/resourcehacker/) and removed the manifest resource embedded in it.
所以我只是在 Resource Hacker ( http://www.angusj.com/resourcehacker/) 中加载了 %PythonPath%\Lib\site-packages\lxml\etree.pyd并删除了嵌入其中的清单资源。
回答by Graham Dumpleton
Installing the DLLs isn't enough, you will need to fiddle Apache to use them. See:
安装 DLL 是不够的,您需要摆弄 Apache 才能使用它们。看: