Python 环境配置: 安装 pip: A tool for installing and managing Python packages.
To install or upgrade pip, securely download get-pip.py. Then run the following (which may require administrator access):
$ sudo python get-pip.py
#Upgrade pip
$ pip install -U pip
注:也可以 brew install python
来安装 pip
Install virtualenv
$ sudo pip install virtualenv
$ sudo pip install virtualenvwrapper
$ subl ~/.zshrc
添加:source /usr/local/bin/virtualenvwrapper.sh
创建新的虚拟环境:$ mkvirtualenv venv
,环境存放的目录是~/.virtualenv/venv
;
$ workon #列出当前环境
$ workon venv
#切换环境
$ deactivate #退出环境
Ref: Install Python 2.7 (homebrew + pip + virtualenv) on Mac OS X Lion
pip 安装 Python 库总是下载超时,修改 pip 源:建个文件 ~/.pip/pip.conf, 内容如下:
Ref:http://segmentfault.com/q/1010000000162410