pywintypes27.dll not found using Apache, Django, pywin32, Python2.7 and mod_wsgi

Deadly 提交于 2019-12-07 08:44:11

问题


I have a Django application using django-mssql to communicate w/ SQL Server.

This works just fine in the dev server (runserver) but under Apache/mod-wsgi, I get a error related to it trying to find a .dll which does exist:

Exception Type: ImportError
Exception Value:    No system module 'pywintypes' (pywintypes27.dll)
Exception Location: C:\Python27\lib\site-packages\win32\lib\pywintypes.py in __import_pywin32_system_module__, line 98
Python Executable:  C:\Program Files (x86)\Apache Software Foundation\Apache2.2\bin\httpd.exe

I used ActivePython2.7.2, mod_wsgi, pywin32 Build 216 and Django1.3.1, all of 32 bits

pywintypes27.dll exists in C:\Windows\SysWOW64 instead of C:\Windows\System32 as expected in my 64 bit windows 7

Thanks in advance

This is the same question as django-mssql not working in Apache w/ mod-wsgi, but works fine in dev server but that answer didn't help me cause I have installed 32 bits pywin32, I am new to stackoverflow and hope it is right to ask as a new question rather than hijack people's thread.


回答1:


Move files:

  • pythoncom27.dll
  • pythoncomloader27.dll
  • pywintypes27.dll

from "C:\Python27\Lib\site-packages\pywin32_system32"

to

"C:\Python27"

Hope it helps.




回答2:


Install pywin32-218.win32-py2.7.exe in machines of 32 or 64 bits.




回答3:


For those who installed pywin32 via pip : check that you have done it outside a virtualenv.

If you've done it inside virtualenv, we can get this kind of error.

Prefer binarie installation : See Mark Amery response here



来源:https://stackoverflow.com/questions/7755626/pywintypes27-dll-not-found-using-apache-django-pywin32-python2-7-and-mod-wsgi

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