用pyenv管理Python多版本及下載加速方法--Mac上

 

原文:https://www.jianshu.com/p/91fc7ecc5e46css

先大體介紹下pyenv的安裝及配置流程。隨後介紹加速下載方法python

安裝:

brew install pyenv

配置

在以下文件中git

~/.bash_profile

添加配置github

export PYENV_ROOT=/usr/local/var/pyenv if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi 

若是使用zsh,則須要在以下文件中bash

~/.zshrc

添加ui

source ~/.bash_profile 

或者將配置代碼直接添加到~/.zshrcspa

下載Python

正常只須要執行code

pyenv install 3.6.3 

若是提示錯誤:ssl

BUILD FAILED (OS X 10.13.1 using python-build 20160602) 

能夠執行get

CFLAGS="-I$(brew --prefix openssl)/include" \ LDFLAGS="-L$(brew --prefix openssl)/lib" \ pyenv install -v 3.6.3 

其它錯誤查看:Common-build-problems

>>>>>>>>>>重點來了<<<<<<<<<<

下載加速

打開

/usr/local/Cellar/pyenv/1.1.5/plugins/python-build/share/python-build/3.6.3 

將原來的

https://www.python.org/ftp 

替換爲

http://mirrors.sohu.com 

而後再執行下載命令

參考連接

GitHub倉庫:https://github.com/pyenv/pyenv

搜狐的Python鏡像:http://mirrors.sohu.com/python/

相關文章
相關標籤/搜索