python - Django | unicorn |导入错误 : No module named _ssl

标签 python django ssl python-2.7 gunicorn

如下配置和安装python2.7:

./configure --enable-shared --with-ssl
make
install

然后使用命令 python setup.py install 安装 gunicorn。

安装很顺利,没有任何问题,但现在当我运行时

gunicorn django.wsgi:application

我遇到错误。我应该怎么做才能继续前进?

   Error: class uri 'sync' invalid or not found:

[Traceback (most recent call last):
  File "/glbdevuser6/glb/portal/aettool/local/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/util.py", line 124, in load_class
section, uri)
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 378, in load_entry_point
return get_distribution(dist).load_entry_point(group, name)
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2566, in load_entry_point
return ep.load()
  File "build/bdist.linux-x86_64/egg/pkg_resources.py", line 2260, in load
entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/glbdevuser6/glb/portal/aettool/local/lib/python2.7/site-packages/gunicorn-17.5-py2.7.egg/gunicorn/workers/sync.py", line 12, in <module>
import ssl
  File "/glbdevuser6/glb/portal/aettool/local/lib/python2.7/ssl.py", line 60, in <module>
import _ssl             # if we can't import it, let the error propagate
ImportError: No module named _ssl
]

最佳答案

我假设您使用的是 Linux 发行版,因为您是从源代码编译 python 的。您至少需要 2 个 SSL 库:opensslopenssl-devel

使用 Ubuntu:apt-get install openssl openssl-devel

基于 Redhat:yum install openssl openssl-devel

要从源代码构建,您可以从以下网址下载:opensslopenssl-devel

希望对您有所帮助。

关于python - Django | unicorn |导入错误 : No module named _ssl,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17767275/

相关文章:

python - Linux 中的 Century Gothic 字体

ssl - 将 http 重定向到 https haproxy 使用 ssl passthrough

SSL 和绿色 https

ssl - SAML SP 元数据 : Self-signed Certifcate or CA Certificate, 最佳实践是什么?

python - 如何在快速傅立叶变换中正确缩放频率轴?

python通过读取csv文件垂直而不是水平地做字典

python - pybind11 中是否可以使用 py::cast 访问抽象基类?

python - 抓取终端的输出

python - 我可以使用 GAE + python 2.7 + django.utils.translation 吗?

Django 网络 bash