错误加载模块pyodbc而在Apache上运行 [英] Error loading pyodbc module while running on Apache

查看:266
本文介绍了错误加载模块pyodbc而在Apache上运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

previously我一直在尝试使用Apache的虚拟主机托管多个DEMO Django的项目,并已成功地与计算器的帮助。

Previously I have been trying to host multiple DEMO django projects using a virtual host on apache, and have been successfully with the help of stackoverflow.

现在我一直在试图主机我使用像previous那些相同的技术,新项目。我的新项目连接到 SQL_SERVER 数据库。我的项目中使用Django的时候内置的服务器运行完美。

Now I have been trying to host my new project using the same technique like the previous ones. My new project is connected to the sql_server database. My project runs perfectly when using djangos in-built server.

当我尝试使用Apache的运行我得到一个 500内部服务器错误并我的Apache错误日志显示 -

When i try running using apache i get an 500 Internal Server Error and my apache error logs shows -

Exception occurred processing WSGI script 

ImproperlyConfigured: Error loading pyodbc module: DLL load failed: A dynamic link library (DLL) initialization routine failed.

我的WSGI文件看起来像这样 -

My wsgi file looks like this -

import os
import sys

path = 'C:/path/project1'
if path not in sys.path:
    sys.path.append(path)

os.environ["DJANGO_SETTINGS_MODULE"] = "settings"

from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()

和我确实有 C:\\ WINDOWS \\ Syswow64资料\\ python27.dll在我的机器

And i do have "C:\Windows\SysWOW64\python27.dll" in my machine

我的系统 -
Windows 7中的Apache 2.2,Python 2.7版,Django的1.4.2

My system - Windows 7, Apache 2.2, python 2.7, django 1.4.2

另外一个信息,我发现我的机器上 -
Python 2.7版(R27:82525,2010年7月4日,9点01分59秒)MSC v.1500 32位(英特尔)]在Win32

Another info i found out on my machine - Python 2.7 (r27:82525, Jul 4 2010, 09:01:59) [MSC v.1500 32 bit (Intel)] on win32

朝着这个任何解决方案??

Any solution towards this??

非常感谢家伙...

推荐答案

我设法解决这个问题,花费severl小时google搜索答案后,终于找到了答案的此处,和它说:

I managed to solve this problem, after spending severl hours googling for answers, finally found an answer here, and it says :

看来,这种依赖性正在python.exe内部运行(这是针对同一个链接)满足。当蟒蛇间preTER的DLL版本,而不是由另一个进程托管,窗户的SxS配置应用msvcr90依赖性只蟒蛇DLL。

It appears that this dependency is being satisfied by running inside of python.exe (which is linked against the same). When the dll version of the python interpreter is instead hosted by another process, the windows sxs configuration applies the msvcr90 dependency only to the python dll.

这意味着,在一般情况下,pyodbc.pyd(和可能pyodbcconf.pyd)将在上视窗嵌入式蟒不可用,除非
  主机应用程序针对的相应版本链接
  MSVC运行时。

This means that, in general, pyodbc.pyd (and likely pyodbcconf.pyd) will be unusable in embedded python on windows unless the host application is linked against the appropriate version of the msvc runtimes.

使用mt.exe(在Windows SDK免费提供的工具),并尝试在命令行上的命令。

Use mt.exe (a freely available tool in the windows sdk) and try the commands on the command line.

<一个href=\"http://social.msdn.microsoft.com/Forums/windowsdesktop/en-US/89419579-0097-45b3-b983-b8c24d0ff538/where-do-i-get-mtexe?forum=windowssecurity\"相对=nofollow>我在哪里mt.exe?

mt.exe -inputresource:c:\windows\syswow64\python27.dll;#2 -outputresource:pyodbc.pyd;#2

mt.exe -inputresource:c:\windows\syswow64\python27.dll;#2 -outputresource:pyodbcconf.pyd;#2

希望这西港岛线是有用的人。

Hopefully this wil be usefull for someone.

干杯

这篇关于错误加载模块pyodbc而在Apache上运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆