pyenv BUILD FAILED解決方法

mingaixin發表於2017-01-18

在本機mac上安裝pyenv安裝成功後,用pyenv來安裝python 3.5.0又出現瞭如下的問題:

 -> pyenv install 3.5.0
Downloading Python-3.5.0.tgz...
-> https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgz
Installing Python-3.5.0...

BUILD FAILED (OS X 10.10.5 using python-build 20160130)

Inspect or clean up the working tree at /var/folders/jz/_yq255hj5zgbjjh1_jr4s59h0000gn/T/python-build.20170118092407.6886
Results logged to /var/folders/jz/_yq255hj5zgbjjh1_jr4s59h0000gn/T/python-build.20170118092407.6886.log

Last 10 log lines:
  File "/private/var/folders/jz/_yq255hj5zgbjjh1_jr4s59h0000gn/T/python-build.20170118092407.6886/Python-3.5.0/Lib/ensurepip/__main__.py", line 4, in <module>
    ensurepip._main()
  File "/private/var/folders/jz/_yq255hj5zgbjjh1_jr4s59h0000gn/T/python-build.20170118092407.6886/Python-3.5.0/Lib/ensurepip/__init__.py", line 209, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/jz/_yq255hj5zgbjjh1_jr4s59h0000gn/T/python-build.20170118092407.6886/Python-3.5.0/Lib/ensurepip/__init__.py", line 116, in bootstrap
    _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/jz/_yq255hj5zgbjjh1_jr4s59h0000gn/T/python-build.20170118092407.6886/Python-3.5.0/Lib/ensurepip/__init__.py", line 40, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

解決方法:使用如下語句安裝即可解決問題
CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install -v 3.5.0

參考資料

pyenv BUILD FAILED解決方法

相關文章