Nicholas Carpenedo
Nicholas Carpenedo

Reputation: 97

Create Python Virtual Environment with Specific Version

I am working on a python script that would automatically generate a virtual environment with a specific version. As far as I know, you can only create a virtual environment of a python version already installed on the computer. Is there a way around this? For example, I would like to generate a python 3.7 virtual environment although it is not installed on my computer. Thanks

Upvotes: 0

Views: 3648

Answers (1)

jimakr
jimakr

Reputation: 604

The common way for doing this is by using anaconda, and creating conda environments which let you specify the python version. It is very popular among data scientists and it is used extensively in machine learning because of the many different versions of python and packages you need. Reading your comment about working with AI this is a popular solution to your problem.

To make an enviroment with a specific python after you install use
conda create -n emvname python=3.4

note that you can use conda install package instead of pip for many packages and you should prefer it, pip still works as normal of course.

Upvotes: 1

Related Questions