What is virtualenv
Virtualenv is a Python environment management tool that isolates Python's operating environment. In other words, a project can have a running environment that belongs to this project, thus avoiding errors caused by relying on different modules.
What is Virtualenvwrapper
Virtualenv's upgraded version, more efficient management of the Python development environment. You can view all of the env and switch directly through the env, without the need to input the path and other things, more unified and efficient.
Recommended use: Virtualenvwrapper, the following is the installation and common commands
Installation
pip install virtualenvwrapper
- Add this line to the shell environment
source /usr/local/bin/virtualenvwrapper.sh
Common directives
- To create a new virtual environment:
mkvirtualenv env名称
- To switch environments:
workon env名称
- Exit the Environment:
deactivate
- List all the environments:
lsvirtualenv
- Delete environment:
rmvirtualenv
, Note: Remove the deleted environment before exiting
More instructions: Direct input virtualenvwrapper
will list all instructions and explanations.
Error
If you encounter six installation issues during PIP installation
- You can try using brew to install Python,
- Or
pip install --ignore-installed six
[Python] using Virtualenvwrapper