自制pyenv安装错误dyld:库未加载:/usr/local/opt/readline/lib/libreadline.7.dylib

时间:2019-02-20 00:25:49

标签: python macos homebrew pyenv libreadline

在MacOS Mojave上从Homebrew安装pyenv之后,尝试安装任何python版本时出现构建错误。

针对任何版本运行pyenv install时,构建都会因错误而失败:

dyld: Library not loaded: /usr/local/opt/readline/lib/libreadline.7.dylib
  Referenced from: /usr/local/bin/awk
  Reason: image not found

2 个答案:

答案 0 :(得分:4)

对我来说,解决方案是强制链接我在/usr/local/opt/readline/lib/下拥有的readline 8 lib。

> cd /usr/local/opt/readline/lib/
> ls
libhistory.8.0.dylib  libhistory.a          libreadline.8.dylib   libreadline.dylib
libhistory.8.dylib    libhistory.dylib      libreadline.8.0.dylib libreadline.a         pkgconfig

由于我拥有readline lib的较新版本,因此我试图通过将其符号链接到要查找的文件名来强迫它找到我拥有的版本。例如

> cd /usr/local/opt/readline/lib/
> ln -s libreadline.8.0.dylib libreadline.7.dylib
> ls
libhistory.8.0.dylib  libhistory.a          libreadline.7.dylib   libreadline.8.dylib   libreadline.dylib
libhistory.8.dylib    libhistory.dylib      libreadline.8.0.dylib libreadline.a         pkgconfig

pyenv install x.y.z现在应该可以正常工作(或至少会引发其他错误;)。

答案 1 :(得分:3)

ln -sf /usr/local/opt/readline/lib/libreadline.8.0.dylib /usr/local/opt/readline/lib/libreadline.7.dylib