我正在尝试使用以下命令在Ubuntu 14上运行Docker注册表:
sudo gunicorn --access-logfile - --debug -k gevent -b 0.0.0.0:5000 -w 1 docker_registry.wsgi:application
不幸的是,当我尝试这个时,我收到以下失败消息:
Error: class uri 'gevent' invalid or not found:
[Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gunicorn/util.py", line 139, in load_class
mod = import_module('.'.join(components))
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/usr/local/lib/python2.7/dist-packages/gunicorn/workers/ggevent.py", line 24, in <module>
from gevent.server import StreamServer
File "/usr/local/lib/python2.7/dist-packages/gevent/server.py", line 6, in <module>
from gevent.socket import EWOULDBLOCK, socket
File "/usr/local/lib/python2.7/dist-packages/gevent/socket.py", line 659, in <module>
from gevent.ssl import sslwrap_simple as ssl, SSLError as sslerror, SSLSocket as SSLType
File "/usr/local/lib/python2.7/dist-packages/gevent/ssl.py", line 386, in <module>
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None):
NameError: name 'PROTOCOL_SSLv3' is not defined
我做了一些搜索并发现了一些东西,告诉我安装python-gevent以获得gevent:
sudo apt-get install python-gevent
我这样做并随后调用了dpkg:
dpkg -l|grep python
显示安装了python-gevent。
不幸的是,安装尚未解决问题。我仍然收到同样的失败消息,说gevent无效或找不到。
有谁知道如何解决这个问题?请指教......
答案 0 :(得分:2)
重新安装python-gevent
apt-get install python-gevent
pip install --upgrade gevent
答案 1 :(得分:1)
试一试:
1.找到你的python gevent包文件夹:
$ cd /usr/local/lib/python2.7/dist-packages/gevent
2.update ssl.py
从:
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv3, ca_certs=None):
为:
def get_server_certificate(addr, ssl_version=PROTOCOL_SSLv23, ca_certs=None):
3.try再次:
$sudo gunicorn --access-logfile - --debug -k gevent -b 0.0.0.0:5000 -w 1 docker_registry.wsgi:application