virtualenv is a CLI tool that needs a Python interpreter to run. If you already have a
interpreter the best is to use pipx to install virtualenv into an isolated environment. This has the added
benefit that later you’ll be able to upgrade virtualenv without affecting other parts of the system.
pipx install virtualenv virtualenv --help
Alternatively you can install it within the global Python interpreter itself (perhaps as a user package via the
--user flag). Be cautious if you are using a python install that is managed by your operating system or
another package manager.
pip might not coordinate with those tools, and may leave your system in an
inconsistent state. Note, if you go down this path you need to ensure pip is new enough per the subsections below:
python -m pip install --user virtualenv python -m virtualenv --help
Installing virtualenv via a wheel (default with pip) requires an installer that can understand the
tag (see PEP-503), with pip this is version
9.0.0 (released 2016
November). Furthermore, in case you’re not installing it via the PyPi you need to be using a mirror that correctly
python-requires tag (notably the OpenStack mirrors don’t do this, or older
devpi versions - added with version
When installing via a source distribution you need an installer that handles the
PEP-517 specification. In case of
pip this is version
later (released on 2018 July). If you cannot upgrade your pip to support this you need to ensure that the build
requirements from pyproject.toml are satisfied
before triggering the install.
You can use virtualenv without installing it too. We publish a Python zipapp, you can just download this from https://bootstrap.pypa.io/virtualenv.pyz and invoke this package with a python interpreter:
python virtualenv.pyz --help
The root level zipapp is always the current latest release. To get the last supported zipapp against a given python
minor release use the link
https://bootstrap.pypa.io/virtualenv/x.y/virtualenv.pyz, e.g. for the last virtualenv
supporting Python 3.11 use
If you are looking for past version of virtualenv.pyz they are available here:
https://github.com/pypa/get-virtualenv/blob/<virtualenv version>/public/<python version>/virtualenv.pyz?raw=true
Installing an unreleased version is discouraged and should be only done for testing purposes. If you do so you’ll need
a pip version of at least
18.0.0 and use the following command:
pip install git+https://github.com/pypa/virtualenv.git@main
Python and OS Compatibility#
virtualenv works with the following Python interpreter implementations:
This means virtualenv works on the latest patch version of each of these minor versions. Previous patch versions are supported on a best effort approach.
CPython is shipped in multiple forms, and each OS repackages it, often applying some customization along the way. Therefore we cannot say universally that we support all platforms, but rather specify some we test against. In case of ones not specified here the support is unknown, though likely will work. If you find some cases please open a feature request on our issue tracker.
2023-02-06– we no longer support running under Python
2023-04-19– we no longer support creating environments for Python
In case of macOS we support: