0

我正在使用 apache2 运行 webpy。这是一个非常奇怪的错误,让我感到困惑。以前从未见过这样的错误,我想知道可能是什么原因。

错误在 bson pymongo 模块中。

[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] mod_wsgi (pid=27117): Target WSGI script '/var/www/webpy-app/borg/src/app.py' cannot be loaded 
as Python module.
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] mod_wsgi (pid=27117): Exception occurred processing WSGI script '/var/www/webpy-app/borg/src/ap
p.py'.
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] Traceback (most recent call last):
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/var/www/webpy-app/borg/src/app.py", line 1, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]     import web,json,csv,pymongo,pdb,sys
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/pymongo
/__init__.py", line 61, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/pymongo
/connection.py", line 39, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/pymongo
/mongo_client.py", line 44, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/bson/__
init__.py", line 41, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/bson/_c
bson.py", line 7, in <module>
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52]   File "/opt/python2.7/lib/python2.7/site-packages/pymongo-2.4.1-py2.7-linux-x86_64.egg/bson/_c
bson.py", line 6, in __bootstrap__
[Wed Jan 30 11:40:28 2013] [error] [client 111.93.158.52] AttributeError: PyCapsule_Import "datetime.datetime_CAPI" is not valid

这是 httpd.conf 中的 WSGI 配置

LoadModule wsgi_module modules/mod_wsgi.so
WSGIScriptAlias /borg /var/www/webpy-app/borg/src/app.py/
WSGIPythonPath /opt/python2.7/lib/python2.7/site-packages/
Alias /borg/static /var/www/webpy-app/borg/src/static/
AddType text/html .py

<Directory /var/www/webpy-app/>
      Order deny,allow
      Allow from all
</Directory>

错误是因为 python 库不兼容问题吗?我不确定。任何帮助将不胜感激。

4

1 回答 1

1

通过将 WSGIPythonHome 设置到适当的位置来解决这个问题。WSGI 正在查看一个旧的 Python 库。

于 2013-02-01T04:05:31.247 回答