Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Some guides mention pyvenv (not pyenv) when talking about virtual environments such as the official Python tutorial. Others mention 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 environments? Does virtualenv do the same as pyvenv? Which one should better be used?

like image 266
Ammar Alyousfi Avatar asked Jan 05 '23 00:01

Ammar Alyousfi


1 Answers

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)

like image 117
slezica Avatar answered Jan 10 '23 07:01

slezica