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

安装streamlit时pyarrow编译失败:cmake模块缺失问题求助

问题:安装Streamlit时PyArrow编译失败,提示缺少CMake

执行pip install --upgrade streamlit时出现以下错误:

Building wheels for collected packages: pyarrow
  Building wheel for pyarrow (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Building wheel for pyarrow (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [291 lines of output]


  ModuleNotFoundError: No module named 'cmake'
      error: command 'D:\\Eind Project Programming Final\\venv\\Scripts\\cmake.exe' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pyarrow
Failed to build pyarrow
ERROR: Could not build wheels for pyarrow, which is required to install pyproject.toml-based projects

已尝试操作:

  • 重新安装64位PyCharm和Python
  • 尝试不同版本的相关包
  • 删除并重新安装包
  • 搜索解决方案
  • 使用最新版本的Python、PyCharm及所有包
  • 执行过以下命令:
    pip uninstall streamlit
    pip uninstall wheel 
    pip uninstall setuptools
    pip uninstall pip
    pip install --upgrade streamlit
    pip install --upgrade matplotlib
    pip install --upgrade setuptools
    pip install --upgrade wheel
    pip install --upgrade pyarrow
    pip install --upgrade cmake
    

解决方案

1. 系统级安装CMake(关键步骤)

PyArrow编译需要系统级的CMake,仅通过pip install cmake安装的版本可能未加入系统PATH,导致编译时无法找到。

  • Windows:
    下载对应64位CMake安装包,安装过程中勾选「Add CMake to the system PATH for all users」或「Add CMake to the system PATH for current user」,安装完成后重启终端和PyCharm。

  • macOS:
    用Homebrew安装:

    brew install cmake
    
  • Linux(Debian/Ubuntu):

    sudo apt update && sudo apt install cmake
    

2. 验证CMake安装

打开终端执行以下命令,确认能正常显示版本号:

cmake --version

3. 重新安装依赖

激活你的虚拟环境后,先单独安装PyArrow,再安装Streamlit:

pip install --upgrade pyarrow
pip install --upgrade streamlit

4. 备选方案:安装预编译的PyArrow轮子

如果编译仍然失败,直接安装预编译好的二进制包,跳过编译步骤:

pip install pyarrow --only-binary :all:

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.08.14 23:40:37