python - Pyenv、Python安装失败:未安装OpenSSL开发头
问题描述
我一直无法使用 Pyenv 在 macOS (10.13.6) 上安装 Python,并且已经用尽了有关常见构建问题的建议。
pyenv-doctor 报告:未安装 OpenSSL 开发标头。正如各种相关 GitHub 问题中所建议的那样,重新安装 OpenSSL 没有奏效,没有各种标志设置,例如(各种组合):
export CFLAGS="-I$(brew --prefix openssl)/include"
export CPPFLAGS="-I$(brew --prefix openssl)/include"
export LDFLAGS="-L$(brew --prefix openssl)/lib"
export PKG_CONFIG_PATH="/usr/local/opt/openssl/lib/pkgconfig/"
export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"
(在命令行中也试过这些。)
(通过 Homebrew 尝试了 OpenSSL 1.02p 和 1.1)
试过了
brew install readline xz
和
$ CFLAGS="-I$(xcrun --show-sdk-path)/usr/include" pyenv install 3.6.6
和
$ CFLAGS="-I$(brew --prefix openssl)/include -I$(xcrun --show-sdk-path)/usr/include" LDFLAGS="-L$(brew --prefix openssl)/lib" pyenv install 3.6.6
和
xcode-select --install
(or via downloadable command line tools installer for reinstallation)
没运气。
brew link --force openssl
被禁止(错误消息说使用标志)。
也试过:
$(brew --prefix)/opt/openssl/bin/openssl
并在这里尝试了 OpenSSL/macOS 建议:
https://solitum.net/openssl-os-x-el-capitan-and-brew/
$PATH 显示:
/usr/local/opt/openssl/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/Users/tc/google-cloud-sdk/bin:/Users/tc/.nvm/versions/node/v8.11.3/bin:/Users/tomclaburn/Code/git/flutter/bin:/usr/local/sbin:/usr/local/heroku/bin:/Library/Frameworks/Python.framework/Versions/2.7/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Postgres.app/Contents/Versions/latest/bin:/usr/local/mongodb/bin:/usr/local/opt/openssl/bin/openssl:/usr/local/mongodb/bin:/usr/local/mongodb/bin
和 .bash_profile 包含:
if [ -d "${PYENV_ROOT}" ]; then
export PATH="${PYENV_ROOT}/bin:${PATH}"
eval "$(pyenv init -)"
#eval "$(pyenv virtualenv-init -)"
fi
我怀疑路径或链接丢失/不正确,但我无法确定它可能是什么。任何的建议都受欢迎。
Pyenv 错误输出:BUILD FAILED (OS X 10.13.6 using python-build 20180424)
...
最后 10 个日志行:
checking size of long... 0
checking size of long long... 0
checking size of void *... 0
checking size of short... 0
checking size of float... 0
checking size of double... 0
checking size of fpos_t... 0
checking size of size_t... configure: error: in `/var/folders/jb/h01vxbqs6z93h_238q61d48h0000gn/T/python-build.20180819081705.3009/Python-3.6.6':
configure: error: cannot compute sizeof (size_t)
pyenv-doctor 错误输出:
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 for readline/readline.h... no
checking for SSL_library_init in -lssl... 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... no
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... no
checking for string.h... no
checking for memory.h... no
checking for strings.h... no
checking for inttypes.h... no
checking for stdint.h... no
checking for unistd.h... yes
checking openssl/ssl.h usability... no
checking openssl/ssl.h presence... no
checking for openssl/ssl.h... no
configure: error: OpenSSL development header is not installed.
解决方案
如果这与我的问题相同,那是因为您的路径中有不应该存在的标题。运行brew doctor
,你会看到它抱怨。要修复它,您可以执行以下操作:
mkdir /tmp/includes
brew doctor 2>&1 | grep "/usr/local/include" | awk '{$1=$1;print}' | xargs -I _ mv _ /tmp/includes
推荐阅读
- validation - Grails 3:验证至少 1 个字段的约束模式不为空
- c++ - 快速分配一个 BGR 格式的字节数组和一个 RGB 格式的字节数组?
- javascript - 等待所有 asyc 进程循环完成
- javascript - unicode 日期字段中的本地、非本地和 ISO 有什么区别?
- python - 当我从布尔字段按钮中删除勾号时,用户在用户类别中变得不可见
- list - 从字符串拆分中获取唯一的字符串
- android-11 - NotificationCompat.Builder 中的 setShortcutInfo 和 ShortcutManagerCompat 中的 pushDynamicShortcut 在 Api 30(Android 11)中不起作用
- aurelia - Aurelia:使用索引值来增加输入绑定中的数组值
- python - 使用词嵌入对品牌进行聚类
- python - 使用 PyQt5 在 python 中使用 addEllipse 移动椭圆