OS: MacOS 10.14 Beta
Goal: Install Python 3.7.0 Through PYENV
When trying to install python 3.7.0 through pyenv I get this error, how can I fix this?
Last 10 log lines:
File "/private/tmp/python-build.20180704152803.38921/Python-3.7.0/Lib/ensurepip/__main__.py", line 5, in <module>
sys.exit(ensurepip._main())
File "/private/tmp/python-build.20180704152803.38921/Python-3.7.0/Lib/ensurepip/__init__.py", line 204, in _main
default_pip=args.default_pip,
File "/private/tmp/python-build.20180704152803.38921/Python-3.7.0/Lib/ensurepip/__init__.py", line 117, in _bootstrap
return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
File "/private/tmp/python-build.20180704152803.38921/Python-3.7.0/Lib/ensurepip/__init__.py", line 27, in _run_pip
import pip._internal
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1
Steps Taken To Attempt To Fix:
1) Reinstall XCODE
2) Reinstall XCODE Command Line Tools
3) Read Similar Errors on Stack Overflow
Alternate Questions:
1) zlib should come preinstalled, what kind of issue might I be experiencing?
2) What is an alternate way to manually install python into a pyenv that would also be recognized by pynev?
python-build is a pyenv plugin that provides a pyenv install command to compile and install different versions of Python on UNIX-like systems. You can also use python-build without pyenv in environments where you need precise control over Python version installation.
Specifically for Python 3.7.0 I did the following with success:
Brew gives some nice instructions when you run info zlib
$ brew info zlib
...
For compilers to find zlib you may need to set:
export LDFLAGS="-L/usr/local/opt/zlib/lib"
export CPPFLAGS="-I/usr/local/opt/zlib/include"
...
So given these instructions, I simply cut/paste FTW :)
$ export LDFLAGS="-L/usr/local/opt/zlib/lib"
$ export CPPFLAGS="-I/usr/local/opt/zlib/include"
$ pyenv install 3.7.0 # Succeeded
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With