Python environments
This post is self-service cheat sheet for Python environment and version management. One of the biggest problem with virtual environment in Python is the multiple tools available and how they play together.
The post starts from a point that you already know the options and want to test and try.
pipenv
In case you are using pipenv with different python version. The Pipfile tells pipenv what version to use. In case the version is not installed, Pipenv will call pyenv to install.
Example of a pipfile with a python version setting.
|
|
Showing how pipenv will behave:
|
|
There is an option in pipenv to install the virtual directory in the project directory instead of home subdirectory. Set the environment variable as:
|
|
pyenv
Pyenv is a good tool to manage multiple Python versions in the same machine
|
|
Mixing pyenv with venv and pipenv (winner)
venv option
Often I see them getting out of sync and not working. The most reliable way I found was using pyenv and venv.
|
|
pipenv a new option?
A different option (not tested yet)
|
|