-1

Can I have two separate installations of the same Python version on the same machine with separately tracked libraries and so on? I mean without using virtual machines or Docker.

The machine is Macbook Air M1.

yohrna
  • 1
  • 4
    Does this answer your question? [How to create virtual env with python3](https://stackoverflow.com/questions/43069780/how-to-create-virtual-env-with-python3) – Mike Scotty Oct 28 '21 at 07:11

1 Answers1

0

You can but it is not recommended. The recommended way is to create a virtual environment see: https://docs.python.org/3/library/venv.html.

If you don't want a virtual environment you can just download different python versions from the python website. I would recommend to not add the installation folders to your PATH variable yet.

Go to the python installation folders (see this question for more info about the installation directory: python location on mac osx) and change the name of the python executable (python.exe) to something like python3x.exe where x is the python version. Also do this for pip in the Scripts folder (If there is more than one pip executable you can delete those). Now add the installation folders to your path variable.

Now you can run your python version of choice from the terminal with:

python3x <your python program>

If you want to install packages for that version of python run:

pip3x <packages you want to install for that python version> 
areobe
  • 167
  • 10