Create a virtualenv with both python2 and python3

Zweedeend picture Zweedeend · Nov 6, 2014 · Viewed 21k times · Source

I tried to use virtualenvwrapper to create a virtualenv with both python2 and python3

Per virtualenv with python2 and python3 via Homebrew I hoped this would work:

(The name of the virtualenv is 'double')

mkvirtualenv double -p `which python`
mkvirtualenv double -p `which python3`

It mentions that

Not overwriting existing python script both/bin/python (you must use both/bin/python3.4)

But it that does not seem to be true. Typing python python2.7 python3 and python3.4 all start the python3.4 interpreter.

Answer

Andrew Svetlov picture Andrew Svetlov · Nov 19, 2014

Sorry, virtualenv is designed to support single interpreter version.

If you need to use several python versions on the same codebase please create separate virtual environments.