参考:https://www.it610.com/article/1289813804288385024.htm
1.方式1:下载Anconda3 安装
2.方式2:下载安装virtualenv
3.方式3:下载安装 virtualenvwrapper
这里用到方式3
)下载 pip install virtualenvwrapper
2)安装完成后,在~/.bashrc写入以下内容

vim ~/.bashrc  

export WORKON_HOME=~/Envs
source /usr/local/bin/virtualenvwrapper.sh

然后报错
-bash: /usr/local/bin/virtualenvwrapper.sh: No such file or directory
尝试解决:
ls ~/.local/bin/这里应该能看到刚刚安装的包,有virtualenvwrapper.sh。复制到/usr/local/bin/路径下还是报错。又复制到自己有权限的个人目录下还是报错。
最后解决方法:
只能每次运行的时候起一遍

source /home/zl/env/virtualenvwrapper.sh
$ source /home/zl/env/virtualenvwrapper.sh
virtualenvwrapper.user_scripts creating /home/zl/env/premkproject
virtualenvwrapper.user_scripts creating /home/zl/env/postmkproject
virtualenvwrapper.user_scripts creating /home/zl/env/initialize
virtualenvwrapper.user_scripts creating /home/zl/env/premkvirtualenv
...
$ mkvirtualenv -p python3 py3_env
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/zl/env/py3_env/bin/python3
Also creating executable in /home/zl/env/py3_env/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.
...
(py3_env) zhanglu@gc-8440-01:/data/sensoro/zhanglu/env$ workon py3_env
(py3_env) zhanglu@gc-8440-01:/data/sensoro/zhanglu/env$
Logo

更多推荐