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

Python3.12虚拟环境安装Apache Superset出现pkgutil错误求助

Windows + Python 3.12下安装Apache Superset的numpy构建报错修复方案

问题根源

Python 3.12彻底移除了pkgutil.ImpImporter这个废弃API,而Apache Superset依赖的numpy 1.23.5仍在使用该接口,导致wheel构建失败。升级setuptools无法解决,核心问题是numpy旧版本与Python3.12的兼容性冲突。

可行修复方法(均为Windows环境适用)

方法1:降级Python到3.11.x(最省心)

Python 3.11还保留了pkgutil.ImpImporter,完全兼容numpy 1.23.5及Superset的依赖链:

  • 下载Python 3.11.x正式版并完成安装
  • 创建新虚拟环境:python -m venv superset_env(确保调用的是Python3.11的解释器)
  • 激活环境:superset_env\Scripts\activate.bat(CMD)或superset_env\Scripts\Activate.ps1(PowerShell)
  • 执行pip install apache-superset即可正常完成安装

方法2:手动指定兼容Python3.12的numpy版本

如果不想降级Python,先安装适配3.12的numpy版本,再强制安装Superset并绕过旧依赖约束:

  1. 激活现有Python3.12虚拟环境
  2. 安装高版本numpy:pip install numpy>=1.26.0(该版本已适配Python3.12)
  3. 安装Superset并忽略其自带的numpy依赖:pip install apache-superset --no-deps
  4. 手动安装Superset的其他依赖包(需逐个确认每个包对Python3.12的兼容性,过程较繁琐)

方法3:安装Superset的最新兼容版本

Apache Superset的3.1.0及后续版本已更新依赖约束,支持Python3.12:

  • 安装正式版(如果已发布):pip install apache-superset>=3.1.0
  • 若正式版未出,可安装预发布版:pip install apache-superset==3.1.0rc1
  • 或直接安装GitHub主分支的开发版:pip install git+https://github.com/apache/superset.git@master

前置准备

无论用哪种方法,先确保虚拟环境内的pip是最新版:pip install --upgrade pip

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.03 23:29:55