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

Python3.8构建cura-build-environment报No module named '_abc'如何解决

问题根源

报错核心为系统中存在适配Python3.5的旧版本SIP,CMake查找SIP时优先命中该版本。该版本绑定Python3.5运行时,无法解析Python3.8标准库中新增的位置-only参数分隔符/语法,也无法匹配Python3.8的内置模块,最终触发Python初始化失败、CMake配置中断。

解决步骤
  • 清理旧版本SIP
    执行命令删除Python3.5路径下的SIP残留:

    pip3.5 uninstall sip -y
    rm -rf ~/.local/lib/python3.5/site-packages/sip*
    rm -f ~/.local/bin/sip*
    

    完成后执行which sip,输出为空即清理成功。

  • 安装适配Python3.8的SIP版本
    选择以下任意一种方式安装即可:

    1. 系统源安装(适配Debian/Ubuntu系列操作系统)
    sudo apt update
    sudo apt install python3-sip-dev python3-pyqt5.sip -y
    
    1. pip安装
    python3.8 -m pip install --upgrade pip
    python3.8 -m pip install sip pyqt5-sip
    

    安装完成后执行验证命令:python3.8 -c "import sip; print(sip.__file__)",输出路径属于Python3.8库目录即为安装正确。

  • 重新构建项目
    清空原有构建缓存,指定Python3.8路径重新编译:

    cd /path/to/cura-build-environment/build
    rm -rf *
    cmake .. -DPython3_EXECUTABLE=$(which python3.8)
    sudo make
    

    若仍提示SIP查找失败,可在cmake命令中追加参数指定SIP路径:-DSIP_EXECUTABLE=$(which sip)


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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.10.10 20:51:02