user11882855
user11882855

Reputation:

How to create a Virtualenv with Python 3?

I have a problem with Linux in PC. I installed python3.8. I want work with python 3. When I create a virtualenv file it gets created with python2, but I don't want work with python2. How can I enable python2?

Upvotes: 0

Views: 16309

Answers (2)

Federico Taranto
Federico Taranto

Reputation: 132

Perhaps you can try to locate the location of the python version you want to use the interpreter of (eg. get its path through which python3). Once obtained the path you can create the enviroment specifying the location of the interpreter you want to use for that virtual environment virtualenv -p /usr/bin/python3.6 venv

Upvotes: 0

Shuvojit
Shuvojit

Reputation: 1470

You can set a python version while creating a new virtual environment using the -p flag.

virtualenv -p python3.8 my-env-name

Upvotes: 5

Related Questions