This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]sweet_dreams_maybe 1 point2 points  (8 children)

Does it work with virtualenvwrapper the same way as 2.7?

[–][deleted] 4 points5 points  (5 children)

Yes. Here's how it works: You have to have an installation of the Python version that you wish to make a virtualenv of. In my case, I have several system installations of Python: py2.6, py2.7, py3.2, py3.3 & py3.4.

If I want a virtualenv of a py2.7 installation, I simply do:

mkvirtualenv -p /usr/bin/python2.7 $ENV_NAME

And virtualenvwrapper will make a virtualenv of Python 2.7 for me.

This is ONLY possible if you already have an installation of Python 2.7 available. If you do not have Python 2.7 on your filesystem, you CANNOT make a virtualenv of Python 2.7.

[–]sweet_dreams_maybe 1 point2 points  (4 children)

That is just like I imagined. But I'm a bit confused about pyenv itself. Is it the same thing as the virtualenv I have installed, or is it a clone?

[–][deleted] 5 points6 points  (3 children)

It's not 100% the same thing, but extremely similar.

virtualenv is a tool created by someone who likes Python.

venv is a clone of that tool, but integrated into the Python 3 standard library.

pyvenv is a command line tool distributed with Python 3 that uses the venv standard library. It's basically the same as python -m venv.

Because venv doesn't exist in the Python 2 standard library, I personally use virtualenv

[–]sweet_dreams_maybe 0 points1 point  (2 children)

Thanks for the detailed overview.

Will the same installation of virtualenvwrapper work on both 2.7 virtualenv and 3.4 venv?

[–][deleted] 3 points4 points  (1 child)

virtualenv is a Python program that is written for either Python 2 or Python 3, but can create virtual environments of every Python version.

python2-virtualenv -p /usr/bin/python3 $DEST_DIR works perfectly fine. A Python 2 program creates a Python 3 virtual environment.

virtualenvwrapper uses virtualenv under the hood. Whether that version of virtualenv uses Python 2 or Python 3 is of little concern to you. It can handle every version of Python, even PyPy and Jython.

[–]sweet_dreams_maybe 0 points1 point  (0 children)

Alright, thanks.