Specifying a Python Runtime
Last updated 20 June 2018
Heroku’s Python support extends to the latest stable release from the Python 3.6.x and Python 2.7.x series.
Today, this support extends to these specific runtimes:
Selecting a runtime
Newly created Python applications default to the Python 3.6.4 runtime.
You can specify an explicit version of Python to be used to run your application. For example, if you require Python 2, add the following to your
[requires] python_version = "2.7"
Or, more specifically:
[requires] python_full_version = "2.7.15"
$ pipenv lock to generate the appropriate
Pipfile.lock, and push it to Heroku.
Alternatively, (e.g. if you’re using
pip), you can also supply a
$ cat runtime.txt python-2.7.15
Note: When changing Python runtime versions, all dependencies need to be re–installed.