1 使用pip3安装virtualenv和pipenv后使用指令显示No Command found
- 1.MAC系统默认的是python2.7,通过如下指令将python切换为python3.6
alias python=/usr/local/bin/python3.6
- 2.通过pip指令安装Virtualenv
pip3 install virtualenv
- 3.如果提示“command not found: virtualenv”,可通过如下命令解决:
sudo cp /Library/Frameworks/Python.framework/Versions/3.6/bin/virtualenv /usr/local/bin
- 4.然后command输入命令检查环境变量是否设置成功
2 使用pip3安装包后发现command not Found 的问题
当你通过pip安装了 virtualenvwrapper后,需要在.bash_profile中配置环境变量
export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_SCRIPT=/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh export VIRTUALENVWRAPPER_PYTHON=/Library/Frameworks/Python.framework/Versions/3.4/bin/python3 export VIRTUALENVWRAPPER_VIRTUALENV=/Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenv export VIRTUALENVWRAPPER_VIRTUALENV_ARGS='--no-site-packages' source /Library/Frameworks/Python.framework/Versions/3.4/bin/virtualenvwrapper.sh 路径位置要找到你的python 安装目录 进行更改
这个问题 也是 当你使.zsh或者 iterm2的时候启动shell的时候需要每次都进行 source ./bash_profile
解决办法
terminal在init的2时候并不会执行~/.bash_profile, ~/.bashrc等脚本。这样就导致环境变量的配置不会生效
原因
因为默认启动执行脚本变为了~/.zshrc
解决办法
修改~/.zshrc文件,在其中添加
source ~/.bash_profile
等脚本文件,这样每次启动iterms等shell的时候就能优先执行环境变量文件