最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【已解决】Flask的虚拟环境中把gunicorn的版本从19降低为18

Flask crifan 3269浏览 0评论

折腾:

【未解决】Simple WebSocket Client测试Flask的websocket显示OPENING且弹出undefined对话框

期间,

参考:

heroku – Flask-SocketIO Error during websocket handshake Unexpected response code: 400 – Stack Overflow

去试试,把自己当前的19的gunicorn:

(RunningFast) ➜  staging gunicorn –version
gunicorn (version 19.6.0)
(RunningFast) ➜  staging which gunicorn
/root/Envs/RunningFast/bin/gunicorn

去降低为18

所以需要去了解:

【已解决】Python中如何安装某个特定的版本的包

搜:

gunicorn how downgrade

参考:

Gunicorn error : AttributeError: ‘socket’ object has no attribute ‘cfg_addr’ · Issue #93 · miguelgrinberg/Flask-SocketIO · GitHub

pip uninstall gunicorn
pip install gunicorn==18.0

Deploying Gunicorn — Gunicorn 0.17.4 documentation

(RunningFast) ➜  staging pip uninstall gunicorn
Uninstalling gunicorn-19.6.0:
  /root/Envs/RunningFast/bin/gunicorn
  /root/Envs/RunningFast/bin/gunicorn_django
  /root/Envs/RunningFast/bin/gunicorn_paster
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/DESCRIPTION.rst
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/INSTALLER
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/METADATA
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/RECORD
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/WHEEL
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/entry_points.txt
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/metadata.json
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn-19.6.0.dist-info/top_level.txt
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/__init__.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/__init__.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/_compat.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/_compat.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/__init__.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/__init__.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/base.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/base.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/django_wsgi.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/django_wsgi.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/djangoapp.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/djangoapp.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/pasterapp.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/pasterapp.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/app/wsgiapp.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/arbiter.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/arbiter.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/argparse_compat.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/argparse_compat.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/config.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/config.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/debug.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/debug.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/errors.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/errors.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/glogging.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/glogging.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/__init__.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/__init__.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/_sendfile.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/_sendfile.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/body.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/body.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/errors.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/errors.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/message.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/message.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/parser.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/parser.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/unreader.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/unreader.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/wsgi.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/http/wsgi.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/instrument/__init__.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/instrument/__init__.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/instrument/statsd.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/instrument/statsd.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/management/__init__.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/management/__init__.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/management/commands/__init__.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/management/commands/__init__.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/management/commands/run_gunicorn.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/management/commands/run_gunicorn.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/pidfile.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/pidfile.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/reloader.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/reloader.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/selectors.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/selectors.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/six.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/six.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/sock.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/sock.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/util.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/util.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/__init__.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/__init__.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/_gaiohttp.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/async.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/async.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/base.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/base.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/gaiohttp.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/gaiohttp.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/geventlet.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/geventlet.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/ggevent.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/ggevent.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/gthread.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/gthread.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/gtornado.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/gtornado.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/sync.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/sync.pyc
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/workertmp.py
  /root/Envs/RunningFast/lib/python2.7/site-packages/gunicorn/workers/workertmp.pyc
Proceed (y/n)? y
  Successfully uninstalled gunicorn-19.6.0

再去看看gunicorn有哪些版本:

【整理】gunicorn有哪些历史版本

所以和18.0相近的,只有18.0版本,去试试:18.0

(RunningFast) ➜  staging pip install gunicorn==18.0
Collecting gunicorn==18.0
  Downloading gunicorn-18.0.tar.gz (366kB)
    100% |████████████████████████████████| 368kB 15kB/s 
Building wheels for collected packages: gunicorn
  Running setup.py bdist_wheel for gunicorn … done
  Stored in directory: /root/.cache/pip/wheels/64/07/89/e2dce813bea23a0ee108703f045bfd434597d3ed52671760a7
Successfully built gunicorn
Installing collected packages: gunicorn
Successfully installed gunicorn-18.0

【总结】

想要把gunicorn从最新的版本,降级到18.0版本,则可以:

先卸载最新的(19.6)的版本,再去安装指定的(18.0)的版本:

pip uninstall gunicorn
pip install gunicorn==18.0

转载请注明:在路上 » 【已解决】Flask的虚拟环境中把gunicorn的版本从19降低为18

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
82 queries in 0.194 seconds, using 22.16MB memory