django | gunicorn | ImportError: No module named _

2019-08-15 08:13发布

Configured and installed python2.7 as below:

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

And then install gunicorn with command python setup.py install.

Installation went well without any problem but now when I am running

gunicorn django.wsgi:application

I am getting below error.What should I do to move forward?

   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条回答
看我几分像从前
2楼-- · 2019-08-15 08:19

I assume that you are using a Linux distro since you compiled python from source. You need at least 2 SSL library: openssl and openssl-devel

With Ubuntu: apt-get install openssl openssl-devel

With Redhat based: yum install openssl openssl-devel

To build from source, you can download from: openssl and openssl-devel

Hope it helps.

查看更多
登录 后发表回答