【发布时间】:2011-10-20 06:11:54
【问题描述】:
Centos 5.5 安装了 python 2.4,而我的项目需要 python 2.7。我下载了源代码,运行,删除,然后用几个替代版本再次尝试:
./configure && make && make install
./configure && make && make altinstall
./configure --prefix=/opt/python2.7 && make && make install
我继续安装 setuptools 和 virtualenv(确保引用正确版本的 python,没有符号链接或其他任何奇怪的东西)。为项目构建了一个 virtualenv,为我的服务器正确配置了所有内容,我的最后一步是使用
从源代码为 apache 2.2.1 构建 mod_wsgi 3.3./configure --with-apxs=/path/to/apxs --with-python=/path/to/py2.7 && make && make install
运行 python、在本地测试项目等所有 3 次都运行良好。
但是在安装 mod_wsgi 之后,我的 wsgi 应用程序不断收到愚蠢的导入错误(无法导入操作系统、系统、站点等)。
我在官方 focs https://code.google.com/p/modwsgi/wiki/InstallationIssues 中运行了页面中途描述的简短 sys.path 测试脚本,并在我的日志文件中得到以下输出:
sys.path = [ '/correct/path/to/virtualenv/py2.7/lib64/python2.4/', ... ]
从 code.google.com/p/modwsgi 的建议开始,我尝试了几种不同的 WSGIPythonHome 和 WSGIPythonPath ... 的所有变体
WSGIPythonHome=/path/to/virtualenv/ and ../bin/ and ../bin/python2.7,
WSGIPythonPath=../lib and ../lib/python2.7 and ../lib/python2.7/site-packages.
WSGI 和 Apache 似乎不是这里的问题。这是我如何编译 python2.7 的错误,还是我的 easy_install 和 virtualenv 的配置方式可能有错误?
【问题讨论】:
标签: python gcc virtualenv wsgi setuptools