brew无法make python2.7.8

时间:2021-12-28 22:30:40
  • 为安装poppler gem包,使用PDF渲染库,但是遇到以下错误:
Building native extensions.  This could take a while...
ERROR:  Error installing poppler:
	ERROR: Failed to build gem native extension.
  • 查询提示信息原来是,无法调用brew install poppler,单独运行此命令又出现如下错误:
╰─$ brew install poppler
==> Installing dependencies for poppler: python, gobject-introspection, libtiff, little-cms2, openjpeg
==> Installing poppler dependency: python
==> Downloading https://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz
Already downloaded: /Library/Caches/Homebrew/python-2.7.8.tgz
==> Downloading http://bugs.python.org/file30805/issue10910-workaround.txt
Already downloaded: /Library/Caches/Homebrew/python--patch-9926640cb7c8e273e4b451469a2b13d4b9df5ba3.txt
==> Patching
patching file Include/pyport.h
Hunk #1 succeeded at 713 (offset 14 lines).
Hunk #2 succeeded at 736 (offset 14 lines).
==> ./configure --prefix=/usr/local/Cellar/python/2.7.8_2 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2
==> make
clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include  -DPy_BUILD_CORE  -c ./Modules/_sre.c -o Modules/_sre.o
clang -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes  -I. -IInclude -I./Include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include  -DPy_BUILD_CORE  -c ./Modules/_codecsmodule.c -o Modules/_codecsmodule.o
20 errors generated.
make: *** [Python/mactoolboxglue.o] Error 1
make: *** Waiting for unfinished jobs....
  • 按照提示提示,运行brew install python,同样遇到make错误。
  • 经过两天不断思考,google结果未果情况下,尝试将brew下载的包进行手动编译:
# 将安装包解压
cd /Library/Caches/Homebrew/Python-2.7.8
# 需要和brew安装是运行命令一直,可在上面的信息中得到
./configure --prefix=/usr/local/Cellar/python/2.7.8_2 --enable-ipv6 --datarootdir=/usr/local/Cellar/python/2
make install
# 运行doctor可查看到手动编译会造成未链接警告
brew doctor
# 链接所有python路径
brew link python
# 又提示,某些文件没有权限,直接按照提示使用强制写入
brew link --overwrite --dry-run python
# 现在python以安装完好,运行一下命令可以查看到
brew list
# 现在开始重新安装poppler
brew install poppler
gem install poppler