1.[root@localhost ~]# pip install virtualenvwrapper
2.[root@localhost ~]# pip list
[root@localhost ~]# pip list Package Version ----------------- ------- pbr 5.1.1 pip 18.1 setuptools 40.6.2 six 1.12.0 stevedore 1.30.0 virtualenv 16.2.0 virtualenv-clone 0.4.0 virtualenvwrapper 4.8.2
3.[root@localhost ~]# cd /opt/python37/bin
virtualenvwrapper.sh默认安装在python目录中的bin文件夹下。
4.编辑配置文件vi ~/.bashrc
export WORKON_HOME=/opt/enn export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' export VIRTUALENVWRAPPER_PYTHON=/opt/python37/bin/python3 source /opt/python37/bin/virtualenvwrapper.sh
5.更新配置文件source ~/.bashrc
6.添加环境变量
PATH=/opt/python37/bin:$PATH:$HOME/bin
7.logout重新登录
8.创建虚拟环境
# 创建python3的虚拟环境 [root@localhost bin]# mkvirtualenv -p python3 site1 # 创建python2的虚拟环境 [root@localhost bin]# mkvirtualenv -p python3 site2