2

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.

2
  • Have you actually tried creating two virtualenvs? Or are you asking without having tried anything? :) Commented Dec 29, 2016 at 16:24
  • still in the process of setting up the python3 project right now. so can't test yet =P. while waiting thought i would ask Commented Dec 29, 2016 at 16:39

2 Answers 2

1

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

Sign up to request clarification or add additional context in comments.

Comments

0

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

1 Comment

i'm specifically asking about virtualenvwrapper. because the shortcut convenience commands like mkvirtualenv remain the same, i'm wondering how it would work in a 2.x side-by-side with 3.x scenario

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.