【问题标题】:failed to install python versions using pyenv on macos在 macOS 上使用 pyenv 安装 python 版本失败
【发布时间】:2021-06-29 20:01:06
【问题描述】:

我正在尝试在我的新 MacBook Pro 上使用 pyenv 安装 python 3.8.5。

我能够成功安装 pyenv 并确认它工作正常。 这很奇怪,因为我能够在我的 MacOS 上使用 pyenv 成功安装 python 3.9.2。

当我尝试安装另一个 python 版本(例如 3.8.5)时出现问题。

我收到如下错误消息。

~ » pyenv install 3.8.5
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.5.tar.xz...
-> https://www.python.org/ftp/python/3.8.5/Python-3.8.5.tar.xz
Installing Python-3.8.5...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk

BUILD FAILED (OS X 11.2.2 using python-build 20180424)

Inspect or clean up the working tree at /var/folders/gm/wv5zbtxx6gl2cbg9yszmxnzc0000gn/T/python-build.20210403160603.37920
Results logged to /var/folders/gm/wv5zbtxx6gl2cbg9yszmxnzc0000gn/T/python-build.20210403160603.37920.log

Last 10 log lines:
checking size of _Bool... 1
checking size of off_t... 8
checking whether to enable large file support... no
checking size of time_t... 8
checking for pthread_t... yes
checking size of pthread_t... 8
checking size of pthread_key_t... 8
checking whether pthread_key_t is compatible with int... no
configure: error: Unexpected output of 'arch' on OSX
make: *** No targets specified and no makefile found.  Stop.

我尝试按照一些方法来解决问题,如

中所述

https://github.com/pyenv/pyenv/wiki/Common-build-problems(常见构建问题)

但是,每次尝试使用 pyenv 安装 python 版本时,我都会得到相同的结果。

我是 MacOS 的新手,我想就此获得一些建议。有人可以帮忙吗?

非常感谢!

【问题讨论】:

    标签: python macos virtualenv pyenv


    【解决方案1】:

    您遇到的错误可能是由旧版本的 xcode 命令行工具引起的。 请尝试输入并运行以下命令。它可能会改变一些东西。

    xcode-select --install

    LDFLAGS="-L$(xcrun --show-sdk-path)/usr/lib" pyenv install 3.8.5

    我希望它对你有用。

    【讨论】:

      猜你喜欢
      • 2021-04-13
      • 1970-01-01
      • 2022-08-20
      • 2021-04-30
      • 2019-01-04
      • 2020-06-13
      • 1970-01-01
      • 2023-04-04
      • 1970-01-01
      相关资源
      最近更新 更多