issues with pyenv installs

diary of a codelovingyogi
1 min readMar 20, 2020

I have seen this issue when trying to install Python 3.6.2 and 3.6.5 on MacOS Mojave

python-build: use openssl from homebrewpython-build: use readline from homebrewDownloading Python-3.6.2.tar.xz...-> https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xzInstalling Python-3.6.2...python-build: use readline from homebrewBUILD FAILED (OS X 10.14.2 using python-build 20180424)Inspect or clean up the working tree at /var/folders/6l/6_rvlhpx6k3f60s8lqrt1m9mtcsb3f/T/python-build.20190930121621.8234Results logged to /var/folders/6l/6_rvlhpx6k3f60s8lqrt1m9mtcsb3f/T/python-build.20190930121621.8234.logLast 10 log lines:File "/private/var/folders/6l/6_rvlhpx6k3f60s8lqrt1m9mtcsb3f/T/python-build.20190930121621.8234/Python-3.6.2/Lib/ensurepip/__main__.py", line 4, in <module>ensurepip._main()File "/private/var/folders/6l/6_rvlhpx6k3f60s8lqrt1m9mtcsb3f/T/python-build.20190930121621.8234/Python-3.6.2/Lib/ensurepip/__init__.py", line 189, in _maindefault_pip=args.default_pip,File "/private/var/folders/6l/6_rvlhpx6k3f60s8lqrt1m9mtcsb3f/T/python-build.20190930121621.8234/Python-3.6.2/Lib/ensurepip/__init__.py", line 102, in bootstrap_run_pip(args + [p[0] for p in _PROJECTS], additional_paths)File "/private/var/folders/6l/6_rvlhpx6k3f60s8lqrt1m9mtcsb3f/T/python-build.20190930121621.8234/Python-3.6.2/Lib/ensurepip/__init__.py", line 27, in _run_pipimport pipzipimport.ZipImportError: can't decompress data; zlib not availablemake: *** [install] Error 1

Right after I updated to Mojave, I made sure xcode was installed:

xcode-select --install

You’ll see a message that

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

and a popup will appear on screen to ask you to install xcode, click to install.

Then you should navigate to following folder (Cmd + Shift + G)

/Library/Developer/CommandLineTools/

to see that Packages folder existing with following:

macOS_SDK_headers_for_macOS_10.14.pkg

Previously, I had only seen usr folder.

Now run:

sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /

If you try install pyenv version again, it should work!

--

--