lxml: DLL load failed: The specified module could not be found

安稳与你 提交于 2019-11-27 06:08:24

问题


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.

We're using soaplib, which requires lxml. I tried installing lxml in several ways:

  1. using easy_install
  2. downloading win32 installation binary.

Problem is that running under site under apache raises following error:

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

It raises this error on from lxml import etree

I have googled for solution but found nothing useful. Some info I found:

  1. That there was some change in python26->python27 that changes what dlls are included
  2. 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)

It works when running from django internal server by running manage.py runserver

How can I resolve this issue? Thanks.


回答1:


I installed unofficial builds from http://www.lfd.uci.edu/~gohlke/pythonlibs/

It solved my problem.




回答2:


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:

  • http://comments.gmane.org/gmane.comp.python.lxml.devel/5684
  • http://bugs.python.org/issue4120

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.




回答3:


Installing the DLLs isn't enough, you will need to fiddle Apache to use them. See:

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



来源:https://stackoverflow.com/questions/7228229/lxml-dll-load-failed-the-specified-module-could-not-be-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!