Introduisez pyenv, qui permet les appels de contrôle de version avant d'installer Python.
$ brew install pyenv
Les packages associés, autoconf et pkg-config, sont également installés.
$ brew install pyenv
==> Installing dependencies for pyenv: autoconf, pkg-config
==> Installing pyenv dependency: autoconf
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/autoconf-2.
Already downloaded: /Library/Caches/Homebrew/autoconf-2.69.yosemite.bottle.1.tar.gz
==> Pouring autoconf-2.69.yosemite.bottle.1.tar.gz
? /usr/local/Cellar/autoconf/2.69: 70 files, 3.1M
==> Installing pyenv dependency: pkg-config
==> Downloading https://downloads.sf.net/project/machomebrew/Bottles/pkg-config-
Already downloaded: /Library/Caches/Homebrew/pkg-config-0.28.yosemite.bottle.2.tar.gz
==> Pouring pkg-config-0.28.yosemite.bottle.2.tar.gz
? /usr/local/Cellar/pkg-config/0.28: 10 files, 612K
==> Installing pyenv
==> Downloading https://github.com/yyuu/pyenv/archive/v20141211.tar.gz
######################################################################## 100.0%
==> Caveats
To enable shims and autocompletion add to your profile:
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
To use Homebrew's directories rather than ~/.pyenv add to your profile:
export PYENV_ROOT=/usr/local/opt/pyenv
==> Summary
? /usr/local/Cellar/pyenv/20141211: 315 files, 2.7M, built in 4 seconds
$
Créer un répertoire ~ / .pyenv ~ / .bash_profile changement
.bash_profile
export PYENV_ROOT=/usr/local/opt/pyenv
eval "$(pyenv init -)"
Vérifiez ce qui peut être installé
$ pyenv install -l
Available versions:
2.1.3
2.2.3
2.3.7
2.4
2.4.1
2.4.2
2.4.3
2.4.4
2.4.5
2.4.6
2.5
2.5.1
2.5.2
2.5.3
2.5.4
2.5.5
2.5.6
2.6.6
2.6.7
2.6.8
2.6.9
2.7-dev
2.7
2.7.1
2.7.2
2.7.3
2.7.4
2.7.5
2.7.6
2.7.7
2.7.8
2.7.9
···réduction···
Cette fois, installez la dernière version 2.7.9 de la série 2
$ pyenv install 2.7.9
Les apparentés seront également installés.
$ pyenv install 2.7.9
Downloading readline-6.3.tar.gz...
-> http://ftpmirror.gnu.org/readline/readline-6.3.tar.gz
Installing readline-6.3...
Installed readline-6.3 to /usr/local/opt/pyenv/versions/2.7.9
Downloading Python-2.7.9.tgz...
-> https://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
Installing Python-2.7.9...
Installing setuptools from https://bootstrap.pypa.io/ez_setup.py...
Installing pip from https://bootstrap.pypa.io/get-pip.py...
Installed Python-2.7.9 to /usr/local/opt/pyenv/versions/2.7.9
$
Confirmation d'installation
$ pyenv versions
* system (set by /usr/local/opt/pyenv/version)
2.7.9
$ python --version
Python 2.7.6
$