Search code examples
pythonpython-3.xvirtualenvvirtual-environment

How to create virtual environments with different Python versions


I am very new to Python. I am trying to install a library called Mesa (https://mesa.readthedocs.io/en/master/index.html) in a virtual environment, but each time I try to clone the repository I get the error message: An error occurred while installing pandas==1.2.4

I believe the problem is that I have installed Python 3.9, but Mesa works with Python 3.7. I have installed Python 3.7 on my computer also, but do not know how to make a virtual environment which runs Python 3.7.

I have virtualenv installed but this is as far as I have gotten... very specific answers would be much appreciated as I still don't really know what I am doing!


Solution

  • With python3.8:- virtualenv -p python3.8 env_name
    replace python version like python3.9, python3.7..