Which are the virtual environments create tools available in Python (like npm and yarn in Node.JS) and how are packages installed and handled using those tools?

1 Answer 1


In Python 2 there was virtualenv (which you had to pip install) but from V3.3 Python 3 comes with venv in the standard libraries.

There are also numerous pip installable alternatives to the above notably pipvenv.

The built in venv (and the older virtualenv) work by you creating your virtual environment once to a specified directory such as:

python -mvenv ./myvenv

This creates a copy, (in the specified directory), of python, pip and the standard libraries, (you can specify a specific version of python from those that you have installed). You can then, (at any time), activate it by running ./myvenv/bin/activate, on windows it is .\myvenv\Scripts\activate.bat which:

  • Modifies your path to point to the copies of python & pip
  • Modifies your pythonpath to point to those under ./myvenv

While it is active any use of python will use that environment and pip will install to it. (Note that associations are not modified so just running somefile.py will use the same python as it normally would).

You can switch out of the venv with deactivate.

Note that PEP 582 proposes Python local packages directory which, if implemented, will reduce the need for venv/virtualenv, etc.

  • so for now, what do you recommend ?? Should I use venv ?? or are there other tools that can make life easy ?? like conda ! May 23, 2019 at 9:08
  • 1
    If you are using a standard python installation I would recommend starting with venv. Anaconda is not a tool it is an installation package that includes the conda tool as an alternative to pip & venv or pipx. May 24, 2019 at 4:47
  • 1
    thanks @SteveBarnes for the information. May 24, 2019 at 7:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.