ammarx ammarx - 3 days ago 5
Python Question

Do I use `pyvenv` or `virtualenv` for creating a virtual environment?

Some guides mentions

pyvenv
(
pyvenv
not
pyenv
) when talking about virtual environments such as the official Python tutorial. Others mentions
virtualenv
such as in the Hitchhiker's Guide to Python. I've tried
pyvenv
and I think that it worked as you can see:



and these are the contents of
ve
directory:



So can
pyvenv
be used to create virtual environment? Does
virtualenv
do the same as
pyvenv
? Which one should better be used?

Answer

They are very much alike. The main difference is that virtualenv has been around for a long time, and can be used in most setups.

pyvenv, on the other hand, was designed for Python3, and ships with the standard library since version 3.4.

In other words, virtualenv is the classic choice, while pyvenv is a recent addition to the standard library. I suppose pyvenv will eventually replace virtualenv (as soon as Python 3 replaces Python 2 :P)

Comments