uWSGI运行错误版本的Python

blu*_*hai 6 python django pip version uwsgi

我的django/uwsgi/python因分段错误而崩溃,因为uWSGI显然正在加载不同版本的Python.

我刚刚使用pip安装了uWSGI.这个SO问题解决了涉及从源代码编译的解决方案,但我想避免这种情况.

mihai$ /usr/bin/python
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Segmentation fault: 11

mihai$ /usr/local/bin/python
Python 2.7.6 (v2.7.6:3a1db0d2747e, Nov 10 2013, 00:42:54)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

我希望有一些--flag可以告诉uWSGI使用什么版本的python ...

Sea*_*rry 4

遗憾的是,如果编译它所针对的 python 是错误的,则您必须重新编译它。由于它直接链接到 Python,因此如果您使用不同的 Python,则符号将不匹配。

在评论中您提到您使用了 pip 但没有获得正确的 Python 版本。也许您使用了错误的点?例如,在 Ubuntu 上,您有 Python 2.7 和 3.3。有 pip-2.7 和 pip-3.3。如果您使用 virtualenv,请确保您使用 virtualenv 中的 pip 进行安装。