python - uWSGI 运行错误的 Python 版本

标签 python django version pip uwsgi

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

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

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
>>>

有什么建议吗?

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

最佳答案

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

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

关于python - uWSGI 运行错误的 Python 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20531131/

相关文章:

java - JPA 中的空版本字段?

android - 我可以允许用户卸载我的 Android 应用程序的更新吗?

python - 如何访问 Django 模板中的给定列表元素?

python - 我如何在 Django/Python 中确保所见即所得输入 HTML 的安全性?

python - DRF - 使用直通模型进行 m2m 字段的嵌套序列化

python - 如何让用户只能编辑自己创建的对象?

python - 将 json 文件导入 Django 模型

python - 如何保持键/值与声明的顺序相同?

python - django-gunicorn-nginx : 502 bad gateway

php - 在我的窗口中同时运行 php 5.x 和 php 7.0