Run Flask using python3 not python

前端 未结 2 1365
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 16:42

How can you run Flask app which uses a specific version of python?

On my env \"python\" = python2.7 and \"python3\" = python3.6. I have installed Flask using pip3. I

2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 17:32

    There are several ways:

    1. Virtualenv lets you create isolated python environments with different versions (this is the way I would recommend)

    2. You can put #!/usr/bin/python3 on top of your python file (see here)

    3. Or you can start your script with python3 script.py

    4. As mentioned in the comments above you can also start your script inside a Docker container that hosts a python3 installation

提交回复
热议问题