gunicorn 啓動flask 失敗, print("\nError: %s" % str(e), file=sys.stderr)
[xxxxxxxx jenkins]$ sudo gunicorn -c gunicorn.py --reload xxxxx:app
Traceback (most recent call last):
File “/bin/gunicorn”, line 7, in
from gunicorn.app.wsgiapp import run
File “/usr/lib/python2.7/site-packages/gunicorn/app/wsgiapp.py”, line 9, in
from gunicorn.app.base import Application
File “/usr/lib/python2.7/site-packages/gunicorn/app/base.py”, line 38
print("\nError: %s" % str(e), file=sys.stderr)
^
SyntaxError: invalid syntax
解決辦法:
pip freeze 查看gunicorn 升級到20.0.0最新版本,不支持python2的環境,需要降級到最後一個支持版本 💔 19.9.0
sudo pip install gunicorn==19.9.0
即可解決這個問題 ε(┬┬﹏┬┬)3