What to do if pyenv install does not proceed with an error

Introduction

I tried to change the version of python with pyenv and installed another version I got an error, so make a note of the procedure to deal with Environment: MacOS Mojave version 10.14.6

The error that occurred

$pyenv install 3.6.4


python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.4.tar.xz...
-> https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz
Installing Python-3.6.4...
python-build: use readline from homebrew

BUILD FAILED (OS X 10.14.6 using python-build 20160602)

Inspect or clean up the working tree at /var/folders/_4/hss19f1x2b12ys793gz8lsd00000gn/T/python-build.20191218170128.37056
Results logged to /var/folders/_4/hss19f1x2b12ys793gz8lsd00000gn/T/python-build.20191218170128.37056.log

Last 10 log lines:
  File "/private/var/folders/_4/hss19f1x2b12ys793gz8lsd00000gn/T/python-build.20191218170128.37056/Python-3.6.4/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/private/var/folders/_4/hss19f1x2b12ys793gz8lsd00000gn/T/python-build.20191218170128.37056/Python-3.6.4/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/_4/hss19f1x2b12ys793gz8lsd00000gn/T/python-build.20191218170128.37056/Python-3.6.4/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/_4/hss19f1x2b12ys793gz8lsd00000gn/T/python-build.20191218170128.37056/Python-3.6.4/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

What i did

$ brew install zlib $ brew install sqlite $ export LDFLAGS="${LDFLAGS} -L/usr/local/opt/zlib/lib" $ export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/zlib/include" $ export LDFLAGS="${LDFLAGS} -L/usr/local/opt/sqlite/lib" $ export CPPFLAGS="${CPPFLAGS} -I/usr/local/opt/sqlite/include" $ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/zlib/lib/pkgconfig" $ export PKG_CONFIG_PATH="${PKG_CONFIG_PATH} /usr/local/opt/sqlite/lib/pkgconfig"

result


$ python --version
Python 2.7.13 :: Anaconda custom (x86_64)

$ pyenv install 3.6.4

$ pyenv global 3.6.4

$ python --version
Python 3.6.4

Recommended Posts

What to do if pyenv install does not proceed with an error
What to do if you get an error when installing python with pyenv
What to do if you get an OpenSSL error when installing Python 2 with pyenv
What to do if you get an Undefined error when trying to use pip with pyenv
What to do if an error occurs when importing numpy with VScode
What to do if pip --user returns an error in a virtual environment created with pyenv
What to do if sys / cdefs.h does not exist
What to do if pyenv is not enabled (zsh)
What to do with Magics install
What to do when an error occurs with import _ssl
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if Python does not switch from the System version in pyenv
What to do if you run python in IntelliJ and end with an error
What to do if you can't install pyaudio with pip #Python
[Beanstalk] What to do when an error occurs with import uuid
What to do if you get a UnicodeDecodeError with pip install
What to do if you couldn't send an email to Yahoo with Python.
Note: What to do if pip install fails
What to do if you get an error when trying to load mnist
What to do if you can't install with pip in babun environment
What to do if you get Could not fetch URL 443 with pip
What to do if you get an error when installing Dlib (Ubuntu)
[OSX] [pyenv] What to do when an SSL error occurs in pip
What to do if the user name is changed and the pyenv library path does not pass
EC2 / Amazon Linux2: What to do if you get an "unable to execute'gcc': No such file or directory" error with pip install
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
Workaround if you get an error when trying to install PySide with pip
What to do if you get angry with swapon failed: Operation not permitted
[EC2] What to do when selenium is stuck and processing does not proceed
What to do if an SSL connection error (ssl.SSLError: [SSL: DH_KEY_TOO_SMALL]) occurs on Ubuntu 20.04
What to do if pip install fails in Xcode 5.1
What to do if you can't pip install mysqlclient
What to do if pip install fails to install dependent libraries
What to do if an error occurs when loading a python project created with poetry into VS Code
[Python] Type Error:'WebElement' object is not iterable What to do when an error occurs
What to do if you get an "unknown service" error from your gRPC server
What to do if the print command itself causes an error in Maya python
What to do if you get an error when importing matplotlib in Python (Mac)
How to install and use pyenv, what to do if you can't switch python versions
What to do if you can't sort files with subscripts
What to do if a 0xC0000005 error occurs in tf.train.start_queue_runners ()
What to do if `pip install matplotlib` fails on Mac
What to do if pip install mysqlclient fails on MacOS
What to do if you get the error "Error: opencv3: Does not support building both Python 2 and 3 wrappers" when installing openCV 3
What to do if Jupyter Notebook on WSL does not start automatically in your browser
Do not switch with pyenv global!
What to do if yum breaks
What to do with PYTHON release?
Unable to install Python with pyenv
What to do if you get an error when running "certbot renew" in CakePHP environment
How to install Anaconda with pyenv
Addresses an issue where an error does not occur even if the path does not pass when trying to read an image with cv2.imread ()
What to do if you get an error when vagrant up when you enable public_network or private_network on Vagrant + Arch Linux → Install netctl
What to do if intellisense doesn't work with Anaconda + VSCode + Tensorflow2.1
What to do if python says "fatal error:'stdio.h' file not found"
What to do if you can't build your project with Maven
What to do if you get an error saying c compiler cannot create executables in configure
What to do if you can't find well with grep's -f option
What to do if ipython and python start up with different versions
What to do if you get lost in file reference with FileNotFoundError
What to do if the Chainer (Windows) sample mnist terminates with WinError 183.