Sniper_3B
Sniper_3B

Reputation: 125

What is the default if I install virtualenv using pip and pip3 respectively?

I used sudo pip install virtualenv, then when I run virtualenv ENV in a directory, I get a Python 2 virtual enviroment.

If I use 'pip3 install virtualenv' to install virtualenv again, will it override the previous installation of virtualenv, then when I run virtualenv ENV, I get a Python 3 virtual enviroment? or will it install a new virtualenv in a different name like virtualenv3 in a different place ?

Upvotes: 6

Views: 1624

Answers (1)

holdenweb
holdenweb

Reputation: 37003

You don't need to go to those lengths. You can use Python 2's virtualenv to create a Python 3 virtual environment. Supposing you have Python 3's binary installed at /usr/local/bin/python3 then simply run

virtualenv -p /usr/local/bin/python3 ENV

and you will find that

source ENV/bin/activate

gives you the Python 3 environment you want.

Upvotes: 5

Related Questions