Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does pyvenv replace virtualenv in python3.3 +? [duplicate]

Virtualenvwrapper is a user-friendly shell around Python's virtualenv.

Python 3.3 ships with pyvenv built into the standard library, which aims to supercede virtualenv.

But if I install Virtualenvwrapper on Python3.3, it still installs virtualenv, leading me to believe it doesn't use 'pyvenv' under the covers.

Presumably this doesn't really matter - if I wish to use virtualenvwrapper on Python3.3 I should happily let it use virtualenv instead of pyvenv, and will (for the moment) suffer no ill effects?

like image 819
Jonathan Hartley Avatar asked Sep 20 '13 07:09

Jonathan Hartley


People also ask

Can Python venv be copied?

virtualenv-clone will be installed inside newenv. Now while logged-in as newenv we can create a copy of any existing environment. For example creating the copy of ProjectAenv: (newenv): virtualenv-clone ProjectAenv ProjectBenv (newenv): deactivate # to come out from newenv.

What is Pyvenv?

pyvenv (not to be confused with pyenv in the previous section) is a script shipped with Python 3.3 to 3.7. It was removed from Python 3.8 as it had problems (not to mention the confusing name). Running python3 -m venv has exactly the same effect as pyvenv .

Does python3 come with virtualenv?

Python now comes with its own implementation of virtual environment, by the name of "venv".


1 Answers

Sorry this answer is a bit delayed. pyvenv does not aim to supersede virtualenv, in fact virtualenv in Python 3 depends on the standard library venv module.

The pyvenv command creates an absolutely minimal virtual environment into which other packages can be installed.

The Python 3 version of virtualenv actually subclasses the standard library's implementation and provides hooks to automatically install setuptools and pip into the environment which pyvenv doesn't do on it's own.

As far as I know virtualenvwrapper depends on virtualenv only because the mkvirtualenv or mkproject commands allow you to specify packages to be installed into the new environment, this only works because virtualenv will have already installed setuptools and pip.

So to answer your question I believe you should be able to use virtualenvwrapper on environments created by pyvenv as long as you follow virtualenvwrapper's conventions for where to put things and you either manually install setuptools and pip into the environment or don't use any package management features of virtualenvwrapper.

like image 86
Beau Avatar answered Sep 23 '22 01:09

Beau