A Python tool that creates isolated Node.js virtual environments, each with its own Node.js and npm install, optionally integrated with a Python virtualenv.
pyenv/pyenv-virtualenv
A pyenv plugin that creates, lists, activates and deletes Python virtualenvs and conda environments on UNIX-like systems.
- Stars
- 6,726
- Forks
- 429
- Open issues
- 92
- Last commit
- 26 days ago
What is it?
pyenv-virtualenv extends pyenv, the Python version manager, with commands for managing virtual environments. You can create a virtualenv based on a specific installed Python version with `pyenv virtualenv`, list existing environments with `pyenv virtualenvs`, and remove them with `pyenv virtualenv-delete`. Options are forwarded to the underlying tool, which can be conda, virtualenv, or the standard `python -m venv` module.
When the shell is configured with `pyenv virtualenv-init`, the plugin automatically activates and deactivates an environment as you enter and leave a directory whose `.python-version` file names it. Environments can also be activated manually with `pyenv activate` and `pyenv deactivate`. Conda environments created with conda can be used the same way.
The plugin is installed by cloning it into pyenv's plugins directory, or with Homebrew on macOS. Several environment variables control caching, the virtualenv version, and the shell prompt label.
Key features
- 01Creates virtualenvs from a chosen pyenv-installed Python version.
- 02Lists and deletes existing virtualenvs and conda environments.
- 03Auto-activates environments based on a directory's .python-version file.
- 04Works with conda, virtualenv, or the built-in venv module.
- 05Supports customizing the shell prompt that shows the active environment.
Use cases
- Keeping separate Python environments per project on a macOS or Linux machine.
- Switching automatically between project environments when changing directories in the shell.
- Managing conda environments alongside pyenv-installed Python versions.
Quick start
- 1
Check out pyenv-virtualenv into the pyenv plugin directory
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv - 2
Optionally add pyenv virtualenv-init to your shell for auto-activation
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc - 3
Restart your shell to enable pyenv-virtualenv
exec "$SHELL" - 4
Create a virtualenv based on a Python version managed by pyenv
pyenv virtualenv 2.7.10 my-virtual-env-2.7.10
Things to know
- Supports UNIX-like systems only; it is a pyenv plugin and requires pyenv to be installed.
- Requires pyenv, so you must set up pyenv first.
Topics
FAQ
- What is pyenv-virtualenv?
- A pyenv plugin that creates, lists, activates and deletes Python virtualenvs and conda environments on UNIX-like systems. pyenv-virtualenv extends pyenv, the Python version manager, with commands for managing virtual environments. You can create a virtualenv based on a specific installed Python version with `pyenv virtualenv`, list existing environments with `pyenv virtualenvs`, and remove them with `pyenv virtualenv-delete`. Options are forwarded to the underlying tool, which can be conda, virtualenv, or the standard `python -m venv` module.
- Is pyenv-virtualenv free to use? What license does it have?
- pyenv-virtualenv is open source under the MIT license. Check the license terms before using it in commercial products.
- Is pyenv-virtualenv still maintained?
- Actively maintained. The last commit to pyenv-virtualenv was on Oct 12, 2026.
- What can I use pyenv-virtualenv for?
- Keeping separate Python environments per project on a macOS or Linux machine. Switching automatically between project environments when changing directories in the shell. Managing conda environments alongside pyenv-installed Python versions.
- How do I install pyenv-virtualenv?
- Check out pyenv-virtualenv into the pyenv plugin directory: git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv root)/plugins/pyenv-virtualenv Optionally add pyenv virtualenv-init to your shell for auto-activation: echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc Restart your shell to enable pyenv-virtualenv: exec "$SHELL" Create a virtualenv based on a Python version managed by pyenv: pyenv virtualenv 2.7.10 my-virtual-env-2.7.10
- Where can I get pyenv-virtualenv?
- The source code and installation instructions are on GitHub: https://github.com/pyenv/pyenv-virtualenv
Summary generated by AI from the project's README. GitHub stats refresh daily.
Related projects
A fast, cross-platform reimplementation of the conda package manager in C++, with a statically linked micromamba variant.
A cross-platform, language-agnostic binary package and environment manager that installs isolated environments with packages like C libraries and Python.
A notebook-driven development platform that turns Jupyter Notebooks into Python packages with docs, tests, CI and PyPI/conda releases.
A command-line tool that builds installers for a set of conda packages, producing shell, macOS .pkg, and Windows .exe/.msi installers.
A Homebrew tap that provides formulae for installing multiple PHP versions (5.6 to 8.7) on macOS and Linux.