pyenv install fails on MacOS 11 BigSur

If you are getting the following error:

pyenv install 3.8.6
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.6.tar.xz...
-> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz
Installing Python-3.8.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
BUILD FAILED (OS X 11.1 using python-build 20180424)
Inspect or clean up the working tree at /var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673
Results logged to /var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673.log
Last 10 log lines:
mod_name, mod_spec, code = _get_module_details(mod_name)
File "/private/var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673/Python-3.8.6/Lib/runpy.py", line 144, in _get_module_details
return _get_module_details(pkg_main_name, error)
File "/private/var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673/Python-3.8.6/Lib/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1
pyenv install  3.8.6
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.6.tar.xz...
-> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz

Installing Python-3.8.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 11.1 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673
Results logged to /var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673.log

Last 10 log lines:
    mod_name, mod_spec, code = _get_module_details(mod_name)
  File "/private/var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673/Python-3.8.6/Lib/runpy.py", line 144, in _get_module_details
    return _get_module_details(pkg_main_name, error)
  File "/private/var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673/Python-3.8.6/Lib/runpy.py", line 111, in _get_module_details
    __import__(pkg_name)
  File "<frozen zipimport>", line 241, in load_module
  File "<frozen zipimport>", line 709, in _get_module_code
  File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1
pyenv install 3.8.6 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.8.6.tar.xz... -> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz Installing Python-3.8.6... python-build: use readline from homebrew python-build: use zlib from xcode sdk BUILD FAILED (OS X 11.1 using python-build 20180424) Inspect or clean up the working tree at /var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673 Results logged to /var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673.log Last 10 log lines: mod_name, mod_spec, code = _get_module_details(mod_name) File "/private/var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673/Python-3.8.6/Lib/runpy.py", line 144, in _get_module_details return _get_module_details(pkg_main_name, error) File "/private/var/folders/6x/cp1l4tr97y7g3jxm74n4c6v80000gn/T/python-build.20210106100539.35673/Python-3.8.6/Lib/runpy.py", line 111, in _get_module_details __import__(pkg_name) File "<frozen zipimport>", line 241, in load_module File "<frozen zipimport>", line 709, in _get_module_code File "<frozen zipimport>", line 570, in _get_data zipimport.ZipImportError: can't decompress data; zlib not available make: *** [install] Error 1

Enter fullscreen mode Exit fullscreen mode

It breaks because Python installation cannot find zlib.

The solution is easy – provide CFLAGS from the xcode sdk:

$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.8.6
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.6.tar.xz...
-> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz
Installing Python-3.8.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.6 to /Users/kuba/.pyenv/versions/3.8.6
$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.8.6
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.6.tar.xz...
-> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz
Installing Python-3.8.6...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk


Installed Python-3.8.6 to /Users/kuba/.pyenv/versions/3.8.6
$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.8.6 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.8.6.tar.xz... -> https://www.python.org/ftp/python/3.8.6/Python-3.8.6.tar.xz Installing Python-3.8.6... python-build: use readline from homebrew python-build: use zlib from xcode sdk Installed Python-3.8.6 to /Users/kuba/.pyenv/versions/3.8.6

Enter fullscreen mode Exit fullscreen mode

原文链接:pyenv install fails on MacOS 11 BigSur

© 版权声明
THE END
喜欢就支持一下吧
点赞5 分享
To beleve , each day the sun wll not lve up to ther own smle.
要坚信,每一天的阳光都不会辜负自己的笑容
评论 抢沙发

请登录后发表评论

    暂无评论内容