Install pyenv from Homebrew, install Python from pyenv

Introduce pyenv, which allows version control calls before installing Python.

$ brew install pyenv

The related packages, autoconf and pkg-config, are also installed.

$ 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
$ 

Create ~ / .pyenv directory ~ / .bash_profile change

.bash_profile


export PYENV_ROOT=/usr/local/opt/pyenv
eval "$(pyenv init -)"

Check what can be installed

$ 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

···abridgement···

This time, install the latest version 2.7.9 of 2 series

$ pyenv install 2.7.9

Related ones will also be installed.

$ 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

$

Installation confirmation

$ pyenv versions
* system (set by /usr/local/opt/pyenv/version)
  2.7.9
$ python --version
Python 2.7.6
$

Recommended Posts

Install pyenv from Homebrew, install Python from pyenv
Install the latest Python from pyenv installed with homebrew
Install python from source
Install python (pyenv, pyenv-virtualenv)
Install python with pyenv
I wanted to install Python 3.4.3 with Homebrew + pyenv
install python
HomeBrew can't install Python (at Mavericks)
Install Python from source with Ansible
Unable to install Python with pyenv
Install Python on CentOS using Pyenv
Install Python on CentOS using pyenv
Install Python as a Framework with pyenv
Install Python locally
Install NAOqi python
Install from conda-forge
MeCab from Python
pyenv + anaconda + python3
Install Python Control
Homebrew search from python module name (ShellScript)
Install pyenv and Python 3.6.8 on Ubuntu 18.04 LTS
CentOS8 --Install --Python3
Install Python 3.8.6 on macOS Big Sur using pyenv
Make OpenCV3 available from python3 installed with pyenv
Install vim7.3 (+ python2.4) from source (compatible with Gundo.vim)
Install Python 3 on MacOS Catalina (with Homebrew only)
Use the nghttp2 Python module from Homebrew from pyenv's Python
Use thingsspeak from python
Install python on WSL
Touch MySQL from Python 3
Install pip, pyenv, BeautifulSoup4
Install pyenv and pyenv-virtualenv
Operate Filemaker from Python
How to install Python
Use fluentd from python
Install Python on Pidora.
Notes from installing Homebrew to building an Anaconda environment for Python with pyenv
Access bitcoind from python
Changes from Python 3.0 to Python 3.5
Changes from Python 2 to Python 3.0
homebrew python environment construction
Use MySQL from Python
Install Python on Mac
How to install python
Install Python 3 on Mac
Run python from excel
Install Python3.4 on CentOS 6.6
Execute command from Python
Install Apache 2.4.41 from source
Install python external library
Operate neutron from Python!
Install python on windows
Use MySQL from Python
Operate LXC from Python
Manipulate riak from python
Python PyTorch install tips
Force Python from Fortran
Install Python 2.7.3 on CentOS 5.4
Use BigQuery from python.
Install Python 3.3 on Ubuntu 12.04
Install Python 3.4 on Mac