pyenv:构建失败使用python-build 20180424的OS X 10.15.7

问题描述

我刚刚在macOS Catalina上安装了pyenv,并通过命令await Future.delayed(Duration(seconds: 1),(){ //open or close });得到以下错误消息:

pyenv doctor

日志文件如下:

cloning /Users/joel.rontynen/.pyenv/plugins/pyenv-doctor/bin/.....
Installing python-pyenv-doctor...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD Failed (OS X 10.15.7 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201014132428.46509
Results logged to /var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201014132428.46509.log

Last 10 log lines:
checking readline/readline.h,presence... no
checking for readline/readline.h,... no
checking readline/rlconf.h usability... yes
checking readline/rlconf.h presence... yes
checking for readline/rlconf.h... yes
checking for SSL_library_init in -lssl... no
configure: WARNING: OpenSSL <1.1 not installed. Checking v1.1 or beyond...
checking for OPENSSL_init_ssl in -lssl... no
configure: error: OpenSSL is not installed.
make: *** No targets specified and no makefile found.  Stop.
Problem(s) detected while checking system.

See https://github.com/pyenv/pyenv/wiki/Common-build-problems for kNown solutions.

我使用Homebrew安装了pyenv和pyenv-virtualenv,并通过克隆GitHub存储库安装了更新和Doctor附加组件。命令/var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201021121358.92440 ~ cloning into 'python-pyenv-doctor'... warning: --depth is ignored in local clones; use file:// instead. done. /var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201021121358.92440/python-pyenv-doctor /var/folders/tl/_2700jnn5vj0q5ryygn4c4ww0000gp/T/python-build.20201021121358.92440 ~ checking for gcc... clang checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether clang accepts -g... yes checking for clang option to accept ISO C89... none needed checking for rl_gnu_readline_p in -lreadline... yes checking how to run the C preprocessor... clang -E checking for grep that handles long lines and -e... /usr/bin/grep checking for egrep... /usr/bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking readline/readline.h,usability... no checking readline/readline.h,... no checking readline/rlconf.h usability... yes checking readline/rlconf.h presence... yes checking for readline/rlconf.h... yes checking for SSL_library_init in -lssl... no configure: WARNING: OpenSSL <1.1 not installed. Checking v1.1 or beyond... checking for OPENSSL_init_ssl in -lssl... no configure: error: OpenSSL is not installed. make: *** No targets specified and no makefile found. Stop. 提供以下输出

brew list

我的.zshrc文件如下所示:

fig             pyenv-virtualenv    xz
[email protected]     pyenv               readline

和.zshenv文件如下:

if command -v pyenv 1>/dev/null 2>&1; then
  eval "$(pyenv init -)"
fi

我不确定其他信息是否相关,因此您可以在评论中要求更多信息。

解决方法

问题是与Homebrew一起安装的OpenSSL,但它“未符号链接到/ usr / local,因为macOS提供了LibreSSL”。我是通过运行命令brew info openssl来了解这一点的,该命令说

[email protected]: stable 1.1.1h (bottled) [keg-only]
Cryptography and SSL/TLS Toolkit
https://openssl.org/
/usr/local/Cellar/[email protected]/1.1.1h (8,067 files,18.5MB)
  Poured from bottle on 2020-10-14 at 12:44:32
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/[email protected]
License: OpenSSL
==> Caveats
A CA file has been bootstrapped using certificates from the system
keychain. To add additional certificates,place .pem files in
  /usr/local/etc/[email protected]/certs

and run
  /usr/local/opt/[email protected]/bin/c_rehash

[email protected] is keg-only,which means it was not symlinked into /usr/local,because macOS provides LibreSSL.

If you need to have [email protected] first in your PATH run:
  echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc

For compilers to find [email protected] you may need to set:
  export LDFLAGS="-L/usr/local/opt/[email protected]/lib"
  export CPPFLAGS="-I/usr/local/opt/[email protected]/include"

For pkg-config to find [email protected] you may need to set:
  export PKG_CONFIG_PATH="/usr/local/opt/[email protected]/lib/pkgconfig"

此修复程序可以在“警告”下的此处找到。我在我的〜/ .zshrc文件中添加了导出LDFLAGS和CPPFLAGS行,并且pyenv doctor命令不再给出任何错误。