ubuntu - 无法使用 Python3.8 在 Ubuntu 上安装 dbus-python

标签 ubuntu python-3.8 dbus-python

我想在我的 Ubuntu 上安装 HP 驱动程序 (hplip)。

它尝试安装 d-bus python 包,但失败并说要手动安装。

使用“apt”安装可以正常工作,但可能不适用于我的主要 Python 版本,这就是 hplip 失败的原因:

sudo apt install -y dbus

... 效果很好
timofei@timofei:~/Downloads$ python
Python 3.8.0 (default, Oct 28 2019, 16:14:01) 
[GCC 8.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/dbus/__init__.py", line 77, in <module>
    import dbus.types as types
  File "/usr/lib/python3/dist-packages/dbus/types.py", line 6, in <module>
    from _dbus_bindings import (
ModuleNotFoundError: No module named '_dbus_bindings'

所以我尝试了这个:
pip3 install dbus-python

但没有成功:
    subprocess.CalledProcessError: Command '['/tmp/pip-install-d0ae2vew/dbus-python/configure', '--disable-maintainer-mode', 'PYTHON=/usr/bin/python3', '--prefix=/tmp/pip-install-d0ae2vew/dbus-python/build/temp.linux-x86_64-3.8/prefix']' returned non-zero exit status 1.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-d0ae2vew/dbus-python/setup.py'"'"'; __file__='"'"'/tmp/pip-install-d0ae2vew/dbus-python/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-ivj6cz_0/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/timofei/.local/include/python3.8/dbus-python Check the logs for full command output.

我努力了
pip3 install --upgrade setuptools

,它工作正常。

我能做些什么?

最佳答案

尝试这个:

sudo apt-get install libdbus-1-dev libdbus-glib-1-dbus
sudo pip3 install autokey

关于ubuntu - 无法使用 Python3.8 在 Ubuntu 上安装 dbus-python,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60444193/

相关文章:

ubuntu - openstack CRITICAL keystonemiddleware.auth_token [-] 无法验证

java - 无法使用在 Ubuntu 18.04/Windows 10 上运行的 WildFly 17 发送电子邮件

ubuntu - 如何对同一资源管理器 VM(非经典)同时使用 Azure Bizspark 和即用即付订阅

php - xdebug 设置 PHP 调试

python - 我无法让 INSERT INTO tablename 等在 Python 3.8 pyodbc MySQL 中工作

ubuntu-14.04 - Ubuntu 14.04 上的 Python3.8

python - 使用python接收dbus信号

python - 在 'with' 语句中返回危险吗?

python-3.x - 推荐使用 pydbus 或 dbus-python,有什么区别?