Part 04 – Python virtual environments

Posted by

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

More about shims

More about 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.

The pyenv Git page covers all that you need to know about pyenv like installation and command reference etc.

One comment

Comments are closed.