准备
ubuntu18.04自带python3.6版本
安装pip3
apt install python3-pip
安装virtualenv和virtualenvwrapper
pip3 install virtualenv
pip3 install virtualenvwrapper
配置虚拟环境存放目录
mkdir $HOME/.virtualenvs
修改~/.bashrc文件
export WORKON_HOME=$HOME/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=~/.local/bin/virtualenv
source ~/.local/bin/virtualenvwrapper.sh
重新加载配置
source ~/.bashrc