Install python3 on Mac (El Capitan)

environment

OS X El Capitan(10.11.5) HomeBrew installed

pyenv installation

Python2 is included by default, but I want to manage version switching, so install pyenv (rbenv in ruby)

$ brew install pyenv

Path setting

$ export PYENV_ROOT="$HOME/.pyenv"
$ export PATH="$PYENV_ROOT/bin:$PATH"
$ eval "$(pyenv init -)"

Check the version of python that can be installed

$ pyenv install --list

python install

Install the latest python3.5.1

$ pyenv install 3.5.1

error. .. ..

Downloading Python-3.5.1.tgz...
-> https://www.python.org/ftp/python/3.5.1/Python-3.5.1.tgz
Installing Python-3.5.1...

BUILD FAILED (OS X 10.11.5 using python-build 20160130)

Inspect or clean up the working tree at /var/folders/cc/yzctrdxs00s81p18dssxqhpw0000gn/T/python-build.20160605231006.7256
Results logged to /var/folders/cc/yzctrdxs00s81p18dssxqhpw0000gn/T/python-build.20160605231006.7256.log

Last 10 log lines:
  File "/private/var/folders/cc/yzctrdxs00s81p18dssxqhpw0000gn/T/python-build.20160605231006.7256/Python-3.5.1/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/private/var/folders/cc/yzctrdxs00s81p18dssxqhpw0000gn/T/python-build.20160605231006.7256/Python-3.5.1/Lib/ensurepip/__init__.py", line 209, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/cc/yzctrdxs00s81p18dssxqhpw0000gn/T/python-build.20160605231006.7256/Python-3.5.1/Lib/ensurepip/__init__.py", line 116, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/cc/yzctrdxs00s81p18dssxqhpw0000gn/T/python-build.20160605231006.7256/Python-3.5.1/Lib/ensurepip/__init__.py", line 40, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

It seems that XCode command line tools were needed when updating the OS (https://github.com/yyuu/pyenv/wiki problems # build-failed-error-the-python-zlib-extension-was-not-compiled-missing-the-zlib))

$ xcode-select --install
xcode-select: note: install requested for command line developer tools

Install python3.5.1 again

$ pyenv install 3.5.1

Check version

$ pyenv versions
* system (set by /Users/32mashamasha/.pyenv/version)
  3.5.1

I was able to install (´ ▽ `) ノ

Recommended Posts

Install python3 on Mac (El Capitan)
Install Python on Mac
Install Python 3 on Mac
Install Python 3.4 on Mac
Install pygame on python3.4 on mac
Install pandas 0.14 on python3.4 [on Mac]
Install Python 3.7 Anaconda on MAC, but Python 2
python on mac
Steps to install python3 on mac
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Build a python data analysis environment on Mac (El Capitan)
Install matplotlib on OS X El Capitan
Install Tensorflow on Mac
Install python on WSL
Install pyenv on mac
Install Python on Pidora.
Install Scrapy on python3
Install Ansible on Mac
Install Python3.4 on CentOS 6.6
Install python on windows
Install Python 2.7.3 on CentOS 5.4
Install Python 3.3 on Ubuntu 12.04
Install Caffe on Mac
Install mecab on mac
Install mecab-python on Mac
Install Python 3.6 on Docker
How to rebuild python environment from pyenv on Mac environment (El Capitan)
Install Python 3.8 on RHEL 8 (AppStream)
Install watchdog on Windows + Python 3.3
Install Python 3.8 on CentOS 7 (SCL)
Install module on Anaconda (Mac)
Install OpenPose on mac (Catalina)
Install numba on your Mac
Handling of python on mac
Update python on Mac to 3.7-> 3.8
Install OpenCV on Ubuntu + python
Notes on installing Python on Mac
Python --Install MySQLDB on EC2
Install Django on your Mac
Install pillow on Mac OSX 10.9
[Mac] Tips: Install pyquery on Mac [pyquery]
Install Python 3.8 on CentOS 8 (AppStream)
[Python] [Chainer] [Windows] Install Chainer on Windows
Install Python3 on Mac and build environment [Definitive Edition]
Install Python venv --VSCode --GitHub integration environment on Mac
Install selenium on Mac and try it with python
Steps to install the latest Python on your Mac
Instructions for installing CUDA 7.5 on Mac (El Capitan) + Homebrew
Install Python environment on local PC (pyenv, venv on Mac)
Building a Python environment on Mac
Install Python Pillow on Amazon Linux
Install Python 3.8 on Ubuntu 18.04 (OS standard)
If python on mac goes missing
When import tkinter is not possible on Mac OS X 10.11.3 (El Capitan) + pyenv + Python 3.5.1.
Install anaconda on Mac → Add Library
install python
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Install python2.7 on windows 32bit environment
Steps to install matplotlib on Mac
Install xgboost (python version) on Windows
Create a Python environment on Mac (2017/4)