Life is short, I use pythonpython
pyenv用來管理多個版本的python在用戶目錄的安裝和使用, 相似rbenvgit
brew install python pyenv pyenv-virtualenvwrapper sudo pip install virtualenvwrapper #若是pip不存在 sudo easy_install pip >而後你須要把如下內容粘貼到~/.bash_profile文件中 # pyenv PYENV_ROOT="$HOME/.pyenv" PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)" #pyenv virtualenvwrapper pyenv virtualenvwrapper_lazy
//由於MAC El Capitan安裝python3.5.0時找不到zlib,因此加上CFLAGS和LDFLAGS CFLAGS="-I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \ LDFLAGS="-L$(brew --prefix openssl)/lib" \ pyenv install 3.5.0 pyenv rehash
//這裏不推薦使用系統默認版本(即system), 默認版本在用virtualenvwrapper會報錯 pyenv global 3.5.0
#添加到上述文件中 #pyenv not playing nice with homebrew alias brew="env PATH=${PATH//$(pyenv root)\/shims:/} brew"
1.安裝pythongithub
pyenv install 2.7.10 pyenv rehash
2.刪除pythonsegmentfault
pyenv uninstall 2.7.10
3.查看已安裝版本api
pyenv versions
4.查看當前使用版本bash
pyenv version
以前記得從新啓動下Terminal, 使上面配置生效app
1.建立一個(虛擬?)開發環境code
mkvirtualenv testing workon testing
2.裝一些聽都沒聽過的依賴包(前面的括號裏面會顯示你如今用哪個環境的)homebrew
pip install ... (例如: cherrypy, routes)
3.用的不爽刪了就是了ip
deactivate (或者切換到其餘python虛擬環境中) rmvirtualenv testing