macOS and Most Linux distribution have some version of python shipped with them. This is both a blessing and a headache.
Let’s talk about headaches
- Installation of python can lead to conflicts with system installed version
- You may face version conflicts while trying to setup packages using pip
- You might end up breaking core OS functions
Therefore, one may need to use Python virtual environments
What is a Python virtual environment?
Python virtual environment is and isolated installation of a python version. A virtual environment creates a folder where all the python modules and packages resides for a specific version or a project
In most cases Python virtual environments are implemented using shims and sim links
How to use a virtual environment?
If you have python 3.6 or above already installed you may use virtual environment using python’s inbuilt capabilities. Read more here
The above approach may not be convenient if you want to manage multiple version of python including their installation
This is where a Python environment manager like pyenv comes to rescue.