我有一个安装了Python 3的虚拟环境,使用Ubuntu+NGINX+Gunicorn,但我的Flask应用仍在以2.7.6运行。尽管我已经按照指示进行了系统性的操作,但仍无法找到解决方法。
Gunicorn配置文件
[program:app-server]
command = gunicorn app:app -b localhost:8000
directory = /home/www/app-server
user = appuser
项目目录结构
app-server
----app.py
----venv (virtual environment)
pip3
(或者有时是pip3.4
)进行安装。所以运行pip uninstall gunicorn
(如果你不需要Python 2.6/2.7版本),然后运行pip3 install gunicorn
。如果你忽略了卸载部分或者因为不是你独自的服务器而无法卸载,不用担心,只需运行which gunicorn -a
。你正在使用的可能不是正确的版本。我之前曾经使用过类似于/opt/python-3.4.2/bin/gunicorn
(在CentOS上)。我知道你说的是Ubuntu,但你永远不知道! - Jeremy