Reputation: 125
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
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