本文介绍了pyenv zlib在MacOS上错误:的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过pyenv在我的MBP上并排安装Python 2.7.5和3.6.5.

I am trying to install Python 2.7.5 and 3.6.5 side-by-side on my MBP with with pyenv.

遵循我如何使用Homebrew在Mac上同时安装Python 2和3?,我尝试过:

$ pyenv install 3.6.5

犯了以下错误:

python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.5.tar.xz...
-> https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz
Installing Python-3.6.5...
python-build: use readline from homebrew

BUILD FAILED (OS X 10.13.4 using python-build 20160602)

Inspect or clean up the working tree at /var/folders/d0/t8d3jjp161g2dyrd4k67ypc80000gn/T/python-build.20180426091253.34709
Results logged to /var/folders/d0/t8d3jjp161g2dyrd4k67ypc80000gn/T/python-build.20180426091253.34709.log

Last 10 log lines:
  File "/private/var/folders/d0/t8d3jjp161g2dyrd4k67ypc80000gn/T/python-build.20180426091253.34709/Python-3.6.5/Lib/ensurepip/__main__.py", line 5, in <module>
    sys.exit(ensurepip._main())
  File "/private/var/folders/d0/t8d3jjp161g2dyrd4k67ypc80000gn/T/python-build.20180426091253.34709/Python-3.6.5/Lib/ensurepip/__init__.py", line 204, in _main
    default_pip=args.default_pip,
  File "/private/var/folders/d0/t8d3jjp161g2dyrd4k67ypc80000gn/T/python-build.20180426091253.34709/Python-3.6.5/Lib/ensurepip/__init__.py", line 117, in _bootstrap
    return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths)
  File "/private/var/folders/d0/t8d3jjp161g2dyrd4k67ypc80000gn/T/python-build.20180426091253.34709/Python-3.6.5/Lib/ensurepip/__init__.py", line 27, in _run_pip
    import pip
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1

我尝试了什么

  • 安装zlib:brew install zlib
  • What have I tried

    • Installing zlib: brew install zlib
    • 如何在MBP上使用pyenv安装多个Python环境?

      How can I install multiple Python environment with pyenv on MBP?

      推荐答案

      在Mojave上,安装Xcode命令行工具后,必须运行以下命令:

      On Mojave, after installing Xcode command line tools, had to run the following:

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

      这篇关于pyenv zlib在MacOS上错误:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 05:14