You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

新Mac(macOS Ventura 13.4.1)无法安装Python 3.8.1-3.8.9版本

在macOS Ventura 13.4.1上安装Python 3.8.1-3.8.9失败的解决办法

问题概述

在运行macOS Ventura 13.4.1的Apple Silicon Mac上,无法安装Python 3.8.1至3.8.9版本,尝试pyenv和conda两种方式均失败,具体报错如下:

Pyenv安装报错

% pyenv install 3.8.1

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

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

Inspect or clean up the working tree at /var/folders/p3/4d4l80y16r36dq3s5gf8kq4w0000gn/T/python-build.20230816162703.3291
Results logged to /var/folders/p3/4d4l80y16r36dq3s5gf8kq4w0000gn/T/python-build.20230816162703.3291.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.

Conda安装报错

% conda install python==3.8.1

Collecting package metadata (current_repodata.json): / DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443

- DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/noarch/current_repodata.json HTTP/1.1" 304 0
  \ DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/osx-arm64/current_repodata.json HTTP/1.1" 304 0
  DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/r/noarch/current_repodata.json HTTP/1.1" 304 0
  DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/r/osx-arm64/current_repodata.json HTTP/1.1" 304 0
  done
  Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.
  Collecting package metadata (repodata.json): \ DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
  DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
  DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
  DEBUG:urllib3.connectionpool:Starting new HTTPS connection (1): repo.anaconda.com:443
- DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/r/noarch/repodata.json HTTP/1.1" 304 0
  DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/noarch/repodata.json HTTP/1.1" 304 0
  DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/r/osx-arm64/repodata.json HTTP/1.1" 304 0
  \ DEBUG:urllib3.connectionpool:https://repo.anaconda.com:443 "GET /pkgs/main/osx-arm64/repodata.json HTTP/1.1" 304 0
  done
  Solving environment: unsuccessful initial attempt using frozen solve. Retrying with flexible solve.

PackagesNotFoundError: The following packages are not available from current channels:

- python==3.8.1

Current channels:

- https://repo.anaconda.com/pkgs/main/osx-arm64
- https://repo.anaconda.com/pkgs/main/noarch
- https://repo.anaconda.com/pkgs/r/osx-arm64
- https://repo.anaconda.com/pkgs/r/noarch
- https://conda.anaconda.org/conda-forge/osx-arm64
- https://conda.anaconda.org/conda-forge/noarch

To search for alternate channels that may provide the conda package you're
looking for, navigate to

    https://anaconda.org

and use the search bar at the top of the page.

问题原因

核心原因是版本大于13.0.0的Apple Clang编译器与Python 3.8.1-3.8.9版本不兼容。这些早期的Python 3.8版本没有适配Apple Silicon架构以及新版Clang的编译逻辑,导致编译时出现平台triplet错误;同时conda官方渠道也没有为这些版本提供Apple Silicon(osx-arm64)的预编译包。

解决方案

针对Pyenv的解决方法

  • 升级pyenv到最新版本
    你当前使用的python-build版本是20180424,属于老旧版本,缺少对新版macOS和Apple Silicon的适配补丁。执行以下命令升级:

    brew update && brew upgrade pyenv
    
  • 指定编译参数绕过错误
    如果升级后仍然失败,可通过设置环境变量指定编译器和编译参数:

    CXX=clang++ CFLAGS="-Wno-error=implicit-function-declaration" pyenv install 3.8.x
    

    (将3.8.x替换为你需要安装的具体版本,比如3.8.1)

  • 确保Xcode命令行工具已安装
    若报错提示找不到clang++,先安装Xcode命令行工具:

    xcode-select --install
    

针对Conda的解决方法

由于官方渠道没有osx-arm64架构的Python 3.8.1-3.8.9预编译包,可通过Rosetta 2创建x86_64架构的conda环境:

  1. 创建x86_64架构的环境

    CONDA_SUBDIR=osx-64 conda create -n py38_env python=3.8.x
    

    (将3.8.x替换为目标版本)

  2. 激活并配置环境架构
    激活环境后,设置环境默认使用osx-64子目录:

    conda activate py38_env
    conda config --env set subdir osx-64
    

    之后该环境会通过Rosetta 2运行x86_64版本的Python。


内容的提问来源于stack exchange,提问作者MystMan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.13 02:56:02