ubuntu安装虚拟环境

时间:2023-03-09 16:37:02
ubuntu安装虚拟环境

首先

sudo pip install virtualenv
sudo pip install virtualenvwrapper

然后进行配置

sudo gedit /.bashrc

export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

将上面这两行插入到文件末尾fi之前

然后执行下

source ~/.bashrc

显示这样执行成功

bash: /usr/bin: 是一个目录
virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenvwrapper has been installed for
VIRTUALENVWRAPPER_PYTHON=/usr/bin and that PATH is
set properly.

然后就是常用的创建系列了,最后说一下本次配置基于py2,py3的配置可以参考这篇文章

https://www.cnblogs.com/kadycui/p/9768338.html