pyenv 安装python

安装pyenv

sudo curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash

添加环境变量

WARNING: seems you still have not added 'pyenv' to the load path.

# Load pyenv automatically by adding
# the following to ~/.zshrc:

export PATH="/Users/ailuoy/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

使用cache下载

由于pyenv下载很慢,所以这里使用提前在国内镜像下载好

mkdir ~/.pyenv/cache
wget http://mirrors.sohu.com/python/3.6.0/Python-3.6.0.tar.xz

这样,pyenv 就不回去国外下载了而直接读cache里面的文件

$ pyenv install 3.6.0
python-build: use openssl from homebrew
python-build: use readline from homebrew
Installing Python-3.6.0...
python-build: use readline from homebrew
Installed Python-3.6.0 to /Users/ailuoy/.pyenv/versions/3.6.0

查看安装的版本

$ pyenv versions
* system (set by /Users/ailuoy/.pyenv/version)
  3.6.0

Pycharm设置版本

file

统一管理venv

mkdir -p ~/code/python/envs

参考文章