python - pyenv 无法下载现有版本的 Python

标签 python macos pyenv

根据 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

于是检查aria2ccurlwget能否运行成功。

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/

相关文章:

python - Pandas 中的 plot 立即关闭

python - 为什么 sum 函数的参数需要放在括号中?

python - 如何从文本文件创建嵌套字典

python - 创建 Python 电子邮件(接收)服务器

bash - 全局安装的 NPM 包(带 CLI)返回命令未找到

python - 无法使用 pyenv 切换 Python

python - 管理 Python 版本和库需要什么?

macos - OS X iconutil 报告 "Invalid iconset"

java - 错误: Could not find or load main class IntelliJ MacOs

python - RStudio 发现 Python pyenv 安装,但我无法运行 Python 进程