我最近从Sierra升级到Mojave。之后我尝试使用pyenv install 3.5.6
。这在后台使用自制软件来尝试安装python,它与zipimport.ZipImportError: can't decompress data; zlib not available
失败。在升级之前,相同的命令有效。
之前已经问过这个问题,普遍接受的解决方案是使用以下命令安装xcode命令行工具:xcode-select --install
。
我安装了xcode 10和命令行工具,但zlib仍然不可用。
我尝试使用自制软件安装zlib,但这也无效。
(顺便提一下,我也考虑过从二进制文件安装python,但Mac OS X没有v3.5.6二进制文件)
任何帮助赞赏。
https://github.com/pyenv/pyenv/issues/1219
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
它对我有帮助,答案就在这里:https://github.com/Homebrew/homebrew-core/issues/29176更多细节,这有效:
brew update
installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
brew reinstall python@2