安装
sudo yum install python-virtualenv
How to use
For example, create a **env** virtual environment
virtualenv ENV
By default, the virtual environment relies on site packages in the system environment, which means that the installed third-party package in the system will also be installed in the virtual environment, if you do not want to rely on the package, you can add parameters to --no-site-packages
establish a virtual environment
virtualenv --no-site-packages [虚拟环境名称]
Start the virtual environment
cd ENVsource ./bin/activate
Note that at this point the command line one more (ENV)
, env is the virtual environment name, then all the modules will only be installed in the directory.
Exiting a virtual environment
deactivate
Installing a Python suite in a virtual environment
The virtualenv comes with the PIP installation tool, so the kit that needs to be installed can be run directly:
pip install [套件名称]
Python Virtual Environment: virtualenv