django | gunicorn | ImportError:没有名为_ssl的模块

时间:2013-07-20 22:22:55

标签: 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
]

1 个答案:

答案 0 :(得分:0)

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

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

以Redhat为基础:yum install openssl openssl-devel

要从源代码构建,您可以从:opensslopenssl-devel

下载

希望它有所帮助。