Put Python 2.7.x on Mac OSX 10.15.5 with pyenv

It may be the same on Mac OSX 10.14.x and later, After upgrading the OS to ** 10.15.5 **, I couldn't install 2.7.x with pyenv. I will leave it as a memo.

Installing Python 2.7.13

When I install Python 2.7.13 with pyenv, I get the following error:

% pyenv install 2.7.13
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-2.7.13.tar.xz...
-> https://www.python.org/ftp/python/2.7.10/Python-2.7.10.tar.xz
Installing Python-2.7.13...
patching file ./Lib/site.py
python-build: use readline from homebrew
ERROR: The Python zlib extension was not compiled. Missing the zlib?

Please consult to the Wiki page to fix the problem.
https://github.com/pyenv/pyenv/wiki/Common-build-problems


BUILD FAILED (OS X 10.15.5 using python-build 1.2.8)

Last 10 log lines:
rm -f /Users/nier/.pyenv/versions/2.7.13/share/man/man1/python.1
(cd /Users/nier/.pyenv/versions/2.7.13/share/man/man1; ln -s python2.1 python.1)
if test "xno" != "xno"  ; then \
		case no in \
			upgrade) ensurepip="--upgrade" ;; \
			install|*) ensurepip="" ;; \
		esac; \
		 ./python.exe -E -m ensurepip \
			$ensurepip --root=/ ; \
	fi
%  

solution

In my case, Xcode and CommandLine Tool were already installed, so I got it with the following command.

CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install -v 2.7.13

By the way, if you don't have Xcode installed, install Command Line Tool after installing Xcode.

xcode-select —install

In addition, although it is described in the error, if the above does not solve the problem, it is better to see the official document. .. https://github.com/pyenv/pyenv/wiki/Common-build-problems

Recommended Posts

Put Python 2.7.x on Mac OSX 10.15.5 with pyenv
Put Python 3.x on Ubuntu
Pyenv on Mac OSX Mavericks
python on mac
Put Anaconda on your Mac using Pyenv
Follow active applications on Mac with Python
How to erase Python 2.x on Mac.
Build Python environment with Anaconda on Mac
Installing PIL with Python 3.x on macOS
Get started with the Python framework Django on Mac OS X
How to use python put in pyenv on macOS with PyCall
Install lp_solve on Mac OS X and call it with python.
Install pyenv on mac
Build python environment with pyenv on EC2 (ubuntu)
Install Python 3 on Mac
Run Zookeeper x python (kazoo) on Mac OS X
Try working with Mongo in Python on Mac
Put MeCab binding for Python with pip on Windows, mac and Linux
Install python with pyenv
Install Python 3.4 on Mac
Create a Python3 environment with pyenv on Mac and display a NetworkX graph
Install pyenv on OSX
Make Python built with jhbuild work on OSX
Shpinx (Python documentation builder) on Mac OS X
I installed Pygame with Python 3.5.1 in the environment of pyenv on OS X
Install selenium on Mac and try it with python
Build a Python development environment on Mac OS X
Build a Python environment on your Mac using pyenv
mac OS X 10.15.x pyenv Python If you can't install
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
I want to AWS Lambda with Python on Mac!
Install Python environment on local PC (pyenv, venv on Mac)
Minimum memo when using Python on Mac (pyenv edition)
x86 compiler self-made with python
Python3 + Django ~ Mac ~ with Apache
Run Tensorflow 2.x on Python 3.7
Handling of python on mac
Update python on Mac to 3.7-> 3.8
Install pandas 0.14 on python3.4 [on Mac]
Reinstall python with pyenv with -fPIC
Install pillow on Mac OSX 10.9
Memo on Mac OS X
python with pyenv and venv
Catalina on Mac and pyenv
Using OpenCV with Python @Mac
Python environment construction on Mac (pyenv, virtualenv, anaconda, ipython notebook)
Word Count with Apache Spark and python (Mac OS X)
How to install Python2.7 python3.5 with pyenv (on RHEL5 CentOS5) (2016 Nov)
Using multiple versions of Python on Mac OS X (2) Usage
Create a Python (pyenv / virtualenv) development environment on Mac (Homebrew)
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Test Python with Miniconda on OS X and Linux with travis-ci
Build a Python extension for E-Cell 4 on Mac OSX (Yosemite)
Build a python environment with pyenv (OS X El Capitan 10.11.3)
Build Python3 for Windows 10 on ARM with Visual Studio 2019 (x86) on Windows 10 on ARM
Machine learning environment settings based on Python 3 on Mac (coexistence with Python 2)
Notes on deploying pyenv with Homebrew and managing Python versions
How to install Theano on Mac OS X with homebrew
If python on mac goes missing
Install Python 2.7.9 and Python 3.4.x with pip.
Introducing Python using pyenv on Ubuntu 20.04