w--
w--

Reputation: 6667

virtualenvwrapper side-by-side with python2.7 and python3

I'm starting to do side-by-side work in python2 and python3. (i.e. some projects req python 2 and some req python 3)

How do i use virtualenvwrapper with this requirement?

Do I just install one virtualenvwrapper (either for 2 or for 3) and just set the python binary accordingly at time of virtual env creation? Doesn't seem like that would work.

Upvotes: 2

Views: 143

Answers (2)

w--
w--

Reputation: 6667

Just doing some initial testing right now and it looks like it works without issue. I'm running the python 3 version of virtualenv wrapper with the python 3 binary, but am able to create venvs for python2.x just fine

e.g.

mkvirtualenv myenv -p /usr/lib/python

My existing venvs also working without issue (so far) with this setup

Upvotes: 1

Laughing Horse
Laughing Horse

Reputation: 158

You could just make two separate virtualenvs and specify which python version you'd like on each. Activate them for your python 2 and 3 projects, respectively with:

. ~/.VirtualEnv#/bin/activate

For example:

virtualenv -p python2.7 ~/.VirtualEnv2

virtualenv -p python2.5 ~/.VirtualEnv3

Upvotes: 0

Related Questions