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

Python 3.11.2安装dbus-python遇patchelf编译错误求解决方案

解决dbus-python安装时patchelf编译失败的问题

问题场景

使用Python 3.11.2构建新闻通知程序,执行pip3 install dbus-python时出现错误:

Could not build wheels for patchelf, which is required to install pyproject.toml-based projects This error originates from a subprocess, and is likely not a problem with pip

解决方案

1. 安装系统级编译依赖

patchelf编译需要系统提供基础编译工具和相关库,根据你的发行版执行对应命令:

  • Debian/Ubuntu 系列:
    sudo apt-get update && sudo apt-get install -y build-essential patchelf libdbus-1-dev
    
  • RHEL/CentOS/Fedora 系列:
    sudo dnf install -y gcc gcc-c++ make patchelf dbus-devel
    
  • Arch Linux 系列:
    sudo pacman -S base-devel patchelf dbus
    

2. 重新安装dbus-python

系统依赖安装完成后,再次执行安装命令:

pip3 install dbus-python

3. 备选方案:直接安装系统预编译的Python绑定

如果编译安装仍失败,可通过系统包管理器直接获取维护好的预编译版本:

  • Debian/Ubuntu 系列:
    sudo apt-get install -y python3-dbus
    
  • RHEL/CentOS/Fedora 系列:
    sudo dnf install -y python3-dbus
    
  • Arch Linux 系列:
    sudo pacman -S python-dbus
    

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.07.18 06:29:54