mac OS X 10.15.x pyenv Python If you can't install

If python installation with pyenv fails

just like this Seems more likely to happen in Beta of Catalina

% pyenv install 3.8.0
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.0.tar.xz...
-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Installing Python-3.8.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 10.15.3 using python-build 1.2.15-9-gac246e16)

Inspect or clean up the working tree at /var/folders/xm/g1kzbj4504vc7jy43b8jls480000gn/T/python-build.20191222050242.8852
Results logged to /var/folders/xm/g1kzbj4504vc7jy43b8jls480000gn/T/python-build.20191222050242.8852.log

Last 10 log lines:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:540:6: warning: macro expansion producing 'defined' has undefined behavior [-Wexpansion-to-defined]
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/pthread.h:200:34: note: expanded from macro '_PTHREAD_SWIFT_IMPORTER_NULLABILITY_COMPAT'
        defined(SWIFT_CLASS_EXTRA) && (!defined(SWIFT_SDK_OVERLAY_PTHREAD_EPOCH) || (SWIFT_SDK_OVERLAY_PTHREAD_EPOCH < 1))
                                        ^
220 warnings and 10 errors generated.
make: *** [Parser/parser.o] Error 1
220 warnings and 10 errors generated.
make: *** [Parser/bitset.o] Error 1
220 warnings and 10 errors generated.
make: *** [Parser/metagrammar.o] Error 1

Reinstall pyenv

% mv .pyenv .pyenv_old
% git clone git://github.com/yyuu/pyenv.git ~/.pyenv
Cloning into '/Users/xxx/.pyenv'...
remote: Enumerating objects: 26, done.
remote: Counting objects: 100% (26/26), done.
remote: Compressing objects: 100% (20/20), done.
remote: Total 17572 (delta 9), reused 9 (delta 3), pack-reused 17546
Receiving objects: 100% (17572/17572), 3.44 MiB | 3.90 MiB/s, done.
Resolving deltas: 100% (11936/11936), done.

% echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
% echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
% echo 'eval "$(pyenv init -)"' >> ~/.bash_profile
% source .bash_profile 

Environmental arrangement

% brew install readline xz openssl zlib

Installation execution

% env SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" CFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" CPPFLAGS="-I/usr/local/opt/zlib/include" LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib" pyenv install 3.8.0
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.0.tar.xz...
-> https://www.python.org/ftp/python/3.8.0/Python-3.8.0.tar.xz
Installing Python-3.8.0...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.0 to /Users/xxx/.pyenv/versions/3.8.0

% pyenv global 3.8.0

It seems that this is necessary at the first installation

SDKROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"

CFLAGS="-I/usr/local/opt/openssl/include -I/usr/local/opt/readline/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include" 

CPPFLAGS="-I/usr/local/opt/zlib/include"

LDFLAGS="-L/usr/local/opt/openssl/lib -L/usr/local/opt/readline/lib"

Recommended Posts

mac OS X 10.15.x pyenv Python If you can't install
Install mitmproxy on Mac OS X
Install pgmagick on Mac OS X 10.9
How to install and use pyenv, what to do if you can't switch python versions
What to do if you can't install pyaudio with pip #Python
I want to know if you install Python on Mac ・ Iroha
Install lp_solve on Mac OS X and call it with python.
How to install Theano on Mac OS X 10.10 (using pyenv, anaconda)
Run Zookeeper x python (kazoo) on Mac OS X
Put Python 2.7.x on Mac OSX 10.15.5 with pyenv
Install shogun with python modular (OS X Yosemite)
Shpinx (Python documentation builder) on Mac OS X
Install pyenv on mac
Install Python on Mac
Install python (pyenv, pyenv-virtualenv)
Install python with pyenv
Install Python 3.4 on Mac
What to do if you installed pyenv on Mac OS using Homebrew but the python version doesn't switch
Very easy to install SciPy on Mac OS X
Build a Python development environment on Mac OS X
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
Install Python environment on local PC (pyenv, venv on Mac)
pangolin x python x mac os build failed memorandum unsolved
When import tkinter is not possible on Mac OS X 10.11.3 (El Capitan) + pyenv + Python 3.5.1.
Install pygame on python3.4 on mac
Install pandas 0.14 on python3.4 [on Mac]
Install pyenv from Homebrew, install Python from pyenv
Memo on Mac OS X
Word Count with Apache Spark and python (Mac OS X)
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
Build a python environment with pyenv (OS X El Capitan 10.11.3)
How to install Theano on Mac OS X with homebrew
Install Python 3.8 on Ubuntu 18.04 (OS standard)
If python on mac goes missing
Install Python 2.7.9 and Python 3.4.x with pip.
Get started with the Python framework Django on Mac OS X
HomeBrew can't install Python (at Mavericks)
Installation of scikit-learn (Mac OS X)
Install Python 3.7 Anaconda on MAC, but Python 2
Install Scipy on Mac OS Sierra
Install python3 on Mac (El Capitan)
Quickly install OpenCV 2.4 (+ python) on OS X and try the sample
Unable to install Python with pyenv
I can't install scikit-learn in Python
Install Python 3.9 on Ubuntu 20.04 (OS standard?)
Install Python on CentOS using Pyenv
If Python 3.5.0 installation fails on Mac
Install Python 2.7 on Ubuntu 20.04 (OS standard?)
Steps to install python3 on mac
Install Python on CentOS using pyenv
Install python with mac vs code
What to do if you can't use scikit grid search in Python
What to do if you can't install with pip in babun environment
Notes on setting pyenv and python environment using Homebrew on Mac OS Marvericks
Introduction to Graph Database Neo4j in Python for Beginners (for Mac OS X)
Mac OS X Mavericks 10.9.5 Development environment construction
Install Python as a Framework with pyenv
Solution for pip install error [Python] [Mac]
Installed aws-cli On Mac OS X Lion
How to erase Python 2.x on Mac.
Notes on building Python and pyenv on Mac