今天尝试了pyenv,看介绍发现简单又好用,于是尝试安装3.5.0版本,出错信息如下:
>>>pyenv install 3.5.0Downloading readline-6.3.tar.gz...-> https://yyuu.github.io/pythons/56ba6071b9462f980c5a72ab0023893b65ba6debb4eeb475d7a563dc65cafd43Installing readline-6.3...Installed readline-6.3 to /Users/sunlei/.pyenv/versions/3.5.0Downloading Python-3.5.0.tgz...-> https://www.python.org/ftp/python/3.5.0/Python-3.5.0.tgzInstalling Python-3.5.0...BUILD FAILED (OS X 10.11.3 using python-build 20150913-11-gdb325cc)Inspect or clean up the working tree at /var/folders/1t/9mpc5mhx50vcgflh8ctzjxb80000gn/T/python-build.20160809194045.16266Results logged to /var/folders/1t/9mpc5mhx50vcgflh8ctzjxb80000gn/T/python-build.20160809194045.16266.logLast 10 log lines: File "/private/var/folders/1t/9mpc5mhx50vcgflh8ctzjxb80000gn/T/python-build.20160809194045.16266/Python-3.5.0/Lib/ensurepip/__main__.py", line 4, inensurepip._main()
File "/private/var/folders/1t/9mpc5mhx50vcgflh8ctzjxb80000gn/T/python-build.20160809194045.16266/Python-3.5.0/Lib/ensurepip/__init__.py", line 209, in _main
default_pip=args.default_pip,
File "/private/var/folders/1t/9mpc5mhx50vcgflh8ctzjxb80000gn/T/python-build.20160809194045.16266/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/1t/9mpc5mhx50vcgflh8ctzjxb80000gn/T/python-build.20160809194045.16266/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
之后利用谷歌大法在这里找到了安装方法:https://github.com/yyuu/pyenv/issues/451
CFLAGS="-I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install -v 3.5.0
或者是
xcode-select --install