根据 blog post,我最近安装了 pyenv 并尝试安装一个 python 版本.我运行了一些命令,但遇到错误,我不确定如何解决。
$ pyenv install 3.6.6
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.6.tar.xz...
-> https://www.python.org/ftp/python/3.6.6/Python-3.6.6.tar.xz
error: failed to download Python-3.6.6.tar.xz
BUILD FAILED (OS X 10.12.6 using python-build 20180424)
最佳答案
我遇到了同样的错误。挖掘pyenv源码后,我找到了根本原因。
在 /usr/local/bin/python-build
中,它会检测到一个 http 客户端来下载 tar 文件。首选是aria2c
,然后是curl
,然后是wget
。
于是检查aria2c
、curl
和wget
能否运行成功。
detect_http_client() {
local client
for client in aria2c curl wget; do
if type "$client" &>/dev/null; then
echo "$client"
return
fi
done
echo "error: please install \`aria2c\`, \`curl\`, or \`wget\` and try again" >&2
return 1
}
对于我的问题,我的 aria2c
命令有问题。我之前升级了我的openssl库,然后所有相关命令在执行时都出错。
> aria2c 55.5s
dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib
Referenced from: /usr/local/opt/libssh2/lib/libssh2.1.dylib
重新安装aria2c
及相关库后,问题解决。
重新安装 aria2c
的步骤:
> brew uninstall aria2
> brew install aria2
关于python - pyenv 无法下载现有版本的 Python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53992370/