Bruno Arine

How to configure a Python project using Pyenv

First install the appropriate Python version:

pyenv install <version>
python local <version> (inside dir)

Then create a new environment like this:

pyenv virtualenv <version> <project name>

Now inside the project’s dir:

pyenv local <project name>

Example:

pyenv install 3.6.10
pyenv global 3.6.10
# If you ever want to go back to the system version of Python as the default, you can run this:
# pyenv global system

For example, with pyenv-virtualenv from the project’s root:

pyenv install 3.7.7
pyenv virtualenv 3.7.7 message-ranking
pyenv local message-ranking
pip install -r requirements.txt