博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
MacOS 10.14下pyenv 安装python3.7.0的错误
阅读量:6308 次
发布时间:2019-06-22

本文共 3018 字,大约阅读时间需要 10 分钟。

hot3.png

在MacOS10.14下,使用pyenv安装python3.7.0的时候,报错了,如下:

xwszt@Linxyz:~$ pyenv install 3.7.0python-build: use openssl from homebrewpython-build: use readline from homebrewDownloading Python-3.7.0.tar.xz...-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xzInstalling Python-3.7.0...python-build: use readline from homebrewBUILD FAILED (OS X 10.14 using python-build 20180424)Inspect or clean up the working tree at /var/folders/b_/4ggdxx_539g8cqp2wr2m5sph0000gn/T/python-build.20181012094932.14705Results logged to /var/folders/b_/4ggdxx_539g8cqp2wr2m5sph0000gn/T/python-build.20181012094932.14705.logLast 10 log lines:  File "/private/var/folders/b_/4ggdxx_539g8cqp2wr2m5sph0000gn/T/python-build.20181012094932.14705/Python-3.7.0/Lib/ensurepip/__main__.py", line 5, in 
sys.exit(ensurepip._main()) File "/private/var/folders/b_/4ggdxx_539g8cqp2wr2m5sph0000gn/T/python-build.20181012094932.14705/Python-3.7.0/Lib/ensurepip/__init__.py", line 204, in _main default_pip=args.default_pip, File "/private/var/folders/b_/4ggdxx_539g8cqp2wr2m5sph0000gn/T/python-build.20181012094932.14705/Python-3.7.0/Lib/ensurepip/__init__.py", line 117, in _bootstrap return _run_pip(args + [p[0] for p in _PROJECTS], additional_paths) File "/private/var/folders/b_/4ggdxx_539g8cqp2wr2m5sph0000gn/T/python-build.20181012094932.14705/Python-3.7.0/Lib/ensurepip/__init__.py", line 27, in _run_pip import pip._internalzipimport.ZipImportError: can't decompress data; zlib not availablemake: *** [install] Error 1

注意最后两行,说明找不到zlib。

在网上找了很多文章,多数说要制定zlib的目录 /usr/include。事实上应该是10.14在xcode-select --install中去除了zlib,所以应该自己手动安装zlib。同样使用brew安装:

$ brew install zlib==> Downloading https://homebrew.bintray.com/bottles/zlib-1.2.11.mojave.bottle.t######################################################################## 100.0%==> Pouring zlib-1.2.11.mojave.bottle.tar.gz==> Caveatszlib is keg-only, which means it was not symlinked into /usr/local,because macOS already provides this software and installing another version inparallel can cause all kinds of trouble.For compilers to find zlib you may need to set:  export LDFLAGS="-L/usr/local/opt/zlib/lib"  export CPPFLAGS="-I/usr/local/opt/zlib/include"For pkg-config to find zlib you may need to set:  export PKG_CONFIG_PATH="/usr/local/opt/zlib/lib/pkgconfig"==> Summary  /usr/local/Cellar/zlib/1.2.11: 12 files, 373KB

按照提示,还需要设置环境变量:

$ export LDFLAGS="-L/usr/local/opt/zlib/lib"$ export CPPFLAGS="-I/usr/local/opt/zlib/include"

然后执行命令安装python

$ pyenv install 3.7.0python-build: use openssl from homebrewpython-build: use readline from homebrewDownloading Python-3.7.0.tar.xz...-> https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xzInstalling Python-3.7.0...python-build: use readline from homebrewWARNING: The Python sqlite3 extension was not compiled. Missing the SQLite3 lib?Installed Python-3.7.0 to /Users/xwszt/.pyenv/versions/3.7.0

到此为止,python3.7.0安装完成了,当然这里没有将sqlite3编译完成,这个可以通过brew install sqlite安装即可了。

转载于:https://my.oschina.net/OHC1U9jZt/blog/2243919

你可能感兴趣的文章
PHP5中的魔术方法
查看>>
一段代码,SQL注入猜解数据库用户密码
查看>>
wcf 基础教程 契约 Contract 控制xml输出 数据契约DataContract序列化前身 XmlSerializer xml序列化...
查看>>
概率中国一种没有语料字典的分词方法
查看>>
类型缩放Google map 地图类型
查看>>
Hash Table
查看>>
Renderer.materials
查看>>
UITableView 顶部能够放大的图片
查看>>
PHP概率算法(适用于抽奖、随机广告)
查看>>
C# 程序性能提升篇-1、装箱和拆箱,枚举的ToString浅析
查看>>
EXP-00056遇到Oracle错误1455问题解决办法
查看>>
20款时尚的 WordPress 企业模板【免费主题下载】
查看>>
SQLSERVER 里经常看到的CACHE STORES是神马东东?
查看>>
java中如何生成可执行的jar文件
查看>>
java中synchronized使用方法
查看>>
vim常用命令
查看>>
整型变量
查看>>
微信公众平台开发(92) 多客服(转)
查看>>
自制Unity小游戏TankHero-2D(1)制作主角坦克
查看>>
DevExpress控件水印文字提示 z
查看>>