在 macOS 12.3 Monterey 上安装 Python 3.8.10 时出现问题

hon*_*kun 35 python macos python-3.x apple-m1 macos-monterey

有人在 macOS Monterey M1 Mac 上安装 python 3.8.10 时遇到问题吗?我尝试安装的任何版本pyenv install都会出现此错误:

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

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

Inspect or clean up the working tree at /var/folders/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129 Results logged to /var/folders/yg/s2w3pfj172v6kdwx7hvmq65m0000gn/T/python-build.20220322155830.88129.log

Last 10 log lines: checking for --with-cxx-main=<compiler>... no checking for clang++... no configure:

By default, distutils will build C++ extension modules with "clang++". If this is not intended, then set CXX on the configure command line.

checking for the platform triplet based on compiler characteristics... darwin configure: error: internal configure error for the platform triplet, please file a bug report make: *** No targets specified and no makefile found.  Stop.
Run Code Online (Sandbox Code Playgroud)

我已经尝试了 Google 搜索中的几乎所有问题,但没有成功 =(。我尝试使用安装asdf python plugin and pyenv.

rah*_*ulg 40

苹果公司推出了一项改变,导致其崩溃。

在你的具体情况下pyenv install 3.8.13应该有效。

对于不同版本的其他人应该检查此线程

或者使用以下任何版本 3.7.13、3.8.13、3.9.11 和 3.10.3

  • **3.7.13、3.8.13、3.9.11 和 3.10.3** ^ 附议,这是很好的信息 (4认同)
  • “...或者使用这些版本 3.7.13、3.8.13、3.9.11 和 3.10.3 中的任何一个” &gt;&gt; 太棒了!这些补丁非常重要,因为它们允许安装任何否则无法安装的次要版本。也许你可以在这里添加一些粗体 rahulg。 (2认同)

Isa*_*hne 15

这对我有用。

先安装gcc;

brew install gcc
Run Code Online (Sandbox Code Playgroud)

然后用 gcc 运行 pyenv 安装。

CC=/opt/homebrew/bin/gcc-11 pyenv install 3.8.10
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

  • 结果我自制安装的 gcc 位于 `/usr/local/Cellar/gcc/11.2.0_3/bin/gcc-11` 下,所以我必须相应地修改命令。 (4认同)

小智 14

brew install gcc && CC=`which gcc-11` pyenv install 3.8.10
Run Code Online (Sandbox Code Playgroud)