环境: macOS big sur, zsh
pip install virtualenv
安装后提示:
WARNING: The script virtualenv is installed in '/Users/tonyyan/Library/Python/2.7/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
为zsh添加环境变量:
vi ~/.zshrc
加入以下两行:
# virtualenv for python2.7 export PATH="$PATH:/Users/tonyyan/Library/Python/2.7/bin"
保存并退出vim
source ~/.zshrc
此时可以验证 virtualenv已成功安装
virtualenv --version
virtualenv 20.7.2 from /Users/tonyyan/Library/Python/2.7/lib/python/site-packages/virtualenv/__init__.pyc