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

编程入门 行业动态 更新时间:2024-10-28 20:22:01
本文介绍了无法使用 Python3.8 在 Ubuntu 上安装 dbus-python的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

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

I want to install HP driver (hplip) on my Ubuntu.

它尝试安装 d-bus python 包,但失败并提示手动安装.

It tries to install d-bus python package, but fails and says to install it manually.

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

Installation with "apt" works fine, but maybe not for my main Python version and that's why hplip failed:

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

更多推荐

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

本文发布于:2023-07-05 22:06:15,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1042345.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:Ubuntu   dbus

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!