Cannot get gunicorn to use Python 3

ε祈祈猫儿з 提交于 2019-12-03 16:41:43

Gunicorn is itself a Python application; the Gunicorn PPA only publishes Python 2 versions.

You'd install Gunicorn into Python 3 instead (using pip, preferably into your virtualenv) and run that version:

/home/www/app-server/venv/bin/gunicorn

Although the question is more than a year old, but i figured i should add my answer in case any one come searching

open this file "/usr/bin/gunicorn" with a text editor. In my case I used vim with sudo in other to be able to edit the file

then change the python version to python3 usr/bin/python2.7 will be usr/bin/python3

then change the version number in the file to the version number of the gunicorn installed in virtual env. directory if both are not the same. In my case the version number in the file was 17.0 but what i have is 19.6.0

Note that there are two places to change the version number in the file.

    #! /usr/bin/python3
    # EASY-INSTALL-ENTRY SCRIPT'gunicorn==17.5','console_scripts','gunicorn'
    __requires__ = 'gunicorn==19.6.0'
    import sys
    from pkg_resources import load_entry_point

    if __name__ == '__main__':
        sys.exit(
                  load_entry_point('gunicorn==19.6.0', console_scripts, 
                   'gunicorn')
                )
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!