Linux command
virtualenvwrapper 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Create virtual environment
mkvirtualenv [envname]
Create with specific Python version
mkvirtualenv -p [python3.11] [envname]
Create with packages installed
mkvirtualenv -i [package] [envname]
Create from requirements file
mkvirtualenv -r [requirements.txt] [envname]
Activate environment
workon [envname]
List environments
workon
Deactivate
deactivate
Remove environment
rmvirtualenv [envname]
Copy an environment
cpvirtualenv [source] [dest]
Change directory to project
cdproject
Run command in all environments
allvirtualenv [command]
说明
virtualenvwrapper is a set of shell extensions that enhance the standard virtualenv tool for managing Python virtual environments. It provides convenient wrapper commands for creating, activating, switching between, and deleting environments, all from a centralized location rather than scattered across project directories. The core workflow revolves around the `workon` command for listing and switching environments, `mkvirtualenv` for creation, and `rmvirtualenv` for deletion. All environments are stored in a single configurable directory (typically `~/.virtualenvs`), making them easy to find and manage regardless of where project code resides. The tool also supports project directory association, allowing automatic directory changes when activating an environment, and provides hook scripts that run at key lifecycle events such as environment creation, activation, and deactivation for custom automation.
FAQ
What is the virtualenvwrapper command used for?
virtualenvwrapper is a set of shell extensions that enhance the standard virtualenv tool for managing Python virtual environments. It provides convenient wrapper commands for creating, activating, switching between, and deleting environments, all from a centralized location rather than scattered across project directories. The core workflow revolves around the `workon` command for listing and switching environments, `mkvirtualenv` for creation, and `rmvirtualenv` for deletion. All environments are stored in a single configurable directory (typically `~/.virtualenvs`), making them easy to find and manage regardless of where project code resides. The tool also supports project directory association, allowing automatic directory changes when activating an environment, and provides hook scripts that run at key lifecycle events such as environment creation, activation, and deactivation for custom automation.
How do I run a basic virtualenvwrapper example?
Run `mkvirtualenv [envname]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
Where can I find more virtualenvwrapper examples?
This page includes 11 examples for virtualenvwrapper, plus related commands for nearby Linux tasks.