Python教程

python 2.7 安装virtualenv

本文主要是介绍python 2.7 安装virtualenv,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

环境: 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

 

这篇关于python 2.7 安装virtualenv的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!