Error Installing via Pip on Python 3.13.2

用户在 Windows 11(Python 3.13.2)上运行 pip install open-interpreter 时触发构建失败。同样的问题也出现在使用 oi-windows-installer.ps1 安装脚本的场景中。

Error Installing via Pip on Python 3.13.2

Error Installing via Pip on Python 3.13.2

快速结论:该报错发生在 Python 3.13 上通过 pip 安装 Open Interpreter 时,因为依赖包 tiktoken 使用的 PyO3 v0.20.3 仅支持 Python 3.12 及以下版本。优先尝试设置环境变量 PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 来绕过版本检查,或降级到 Python 3.11/3.12。

问题场景

用户在 Windows 11(Python 3.13.2)上运行 pip install open-interpreter 时触发构建失败。同样的问题也出现在使用 oi-windows-installer.ps1 安装脚本的场景中。

报错原文

error: the configured Python interpreter version (3.13) is newer than PyO3's maximum supported version (3.12)
= help: please check if an updated version of PyO3 is available. Current version: 0.20.3
= help: set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 to suppress this check and build anyway using the stable ABI
      error: `cargo rustc --lib --message-format=json-render-diagnostics --manifest-path Cargo.toml --release -v --features pyo3/extension-module --crate-type cdylib --` failed with code 101
  ERROR: Failed building wheel for tiktoken
  Failed to build tiktoken
ERROR: ERROR: Failed to build installable wheels for some pyproject.toml based projects (tiktoken)

原因分析

根本原因是依赖链中的 PyO3 v0.20.3 在其编译脚本中硬编码了最大 Python 版本为 3.12。当检测到 Python 3.13 时,构建脚本主动报错退出。tiktoken 的 wheel 构建因此失败,导致 Open Interpreter 无法通过 pip 安装。

环境排查

  • 确认 Python 版本:当前为 3.13.2(python --version
  • 检查是否安装了 Rust 编译器(rustc --version)——缺少 Rust 可能加剧问题,但不是核心原因
  • 确认 pip 版本:24.3.1(建议升级到 25.2 或其他最新版,但这不是报错直接原因)
  • 操作系统:Windows 11(Linux/macOS 也可能遇到相同问题)

解决步骤

  1. 方案一(可优先尝试):设置环境变量 PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1 来绕过 PyO3 版本检查,随后重新安装。
    – Windows(CMD):set PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
    – Windows(PowerShell):$env:PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
    – Linux/macOS:export PYO3_USE_ABI3_FORWARD_COMPATIBILITY=1
    然后执行 pip install open-interpreter。注意:后续每次运行 interpreter 命令时可能也需要设置同一环境变量。
  2. 方案二:降级 Python 版本到 3.11 或 3.12,创建一个新的虚拟环境后再安装 Open Interpreter。
    例如:python3.11 -m venv venv,激活后执行 pip install open-interpreter
  3. 方案三(可能原因——非官方确认):等待上游依赖(tiktoken 或 PyO3)更新以支持 Python 3.13。在 Issue 关闭时(2026-05-04),此方案尚未被验证是否已解决。

验证方法

成功运行 pip install open-interpreter 且无报错,之后可以执行 interpreter 命令正常启动交互界面。如果之前设置了环境变量(方案一),则验证时需确保环境变量在当前会话中生效。

参考来源

OpenInterpreter/open-interpreter #1640

GamsGo AI

AI 工具推荐

想把多个 AI 模型放在一个入口?

GamsGo AI 集成 ChatGPT、DeepSeek、Gemini、Claude、Midjourney、Veo 等常用模型,适合写作、绘图、视频和日常 AI 工作流。

了解 GamsGo AI

推广链接:通过此链接购买,我可能获得佣金,不影响你的价格。

celebrityanime
celebrityanime
文章: 8298

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注