我們在Centos 7下安裝完virtualenv 以及virtualenvwrapper後
使用workon 命令報錯:
解決辦法如下:
找到根目錄
cd ~
ls -a
如下:
修改.bash_profile文件
vim .bash_profile
添加如下內容:
VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
export VIRTUALENVWRAPPER_VIRTUALENV=/usr/local/bin/virtualenv
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh
VIRTUALENVWRAPPER_PYTHON 你的python路徑
VIRTUALENVWRAPPER_VIRTUALENV 你安裝的virtualenv路徑
然後保存。使文件生效
source ~/.bash_profile
然後workon 命令成功。