Recently with the new Ubuntu18.04 version comes with the latest version of Python3.6.5, in the installation of Python virtual environment should be aware of:
1. First, install two packages
pip3 install virtualenv # python虚拟环境pip3 install virtualenvwrapper # 封装了虚拟环境,支持一些简化命令
Then through the PIP3 list to see if the installation was successful
2. Add environment variables (NOTE!!!)
vim ~/.bashrc# 在末尾添上(去掉注释)# export WORKON_HOME=$HOME/.virtualenvs# source ~/.local/bin/virtualenvwrapper.sh
3. Execute the ~/.BASHRC
source ~/.bashrc
4. Test Commands available
6. Install the Python virtual environment
# 创建虚拟环境mkvirtualenv -p Python3 虚拟环境名称‘# 查看虚拟环境,并切入到某一个虚拟环境workonworkon 虚拟环境名称# 退出虚拟环境deactivate
6. Do not wake up, in the Ubuntu18.04 the Virtualwarpper execution script location and the previous version location is different, so when you perform step three, pay special attention to:
# 以前的配置路径(ubuntu16.04)# source /usr/local/bin/virtualenvwrapper.sh ubuntu18.04中的配置路径# source ~/.local/bin/virtualwrapper.sh
Installing a Python virtual environment under Ubuntu18.04