安装dbus-python的简要教程

yipeiwu_com6年前Python基础

写一个 python 脚本需要用到 dbus,但因为 dbus-python 这个包并没有提供 setup.py , 所以无法通过 pip 直接安装,唯有下载源码手动编译安装一途了。

wget https://pypi.python.org/packages/source/d/dbus-python/dbus-python-0.84.0.tar.gz
tar zxvf dbus-python-0.84.0.tar.gz
cd dbus-python-0.84.0

但事有不顺,在 ./configure 的过程中,还是出了一些错。

configure: error: Package requirements (dbus-1 >= 1.0) were not met:

No package 'dbus-1' found

Consider adjusting the PKG_CONFIG_PATH environment variable if you
installed software in a non-standard prefix.

Alternatively, you may set the environment variables DBUS_CFLAGS
and DBUS_LIBS to avoid the need to call pkg-config.
See the pkg-config man page for more details.

这显然是缺失了依赖库

sudo apt-get install libdbus-glib-1-dev

然后安装就就可以顺利进行了

./configure
make
sudo make install


相关文章

Python 从一个文件中调用另一个文件的类方法

如果是在同一个 module中(也就是同一个py文件里),直接用就可以 如果在不同的module里,例如 a.py里有 class A: b.py 里有 class B: 如果你要在cl...

Python实现的简单算术游戏实例

本文实例讲述了Python实现的简单算术游戏。分享给大家供大家参考。具体实现方法如下: #!/usr/bin/env python from operator import add,...

python-itchat 获取微信群用户信息的实例

如下所示: import itchat, time from itchat.content import TEXT #name = ' ' roomslist = [] itcha...

如何使用Python 打印各种三角形

直角三角形 rows = int(input('输入列数:')) for i in range(1, rows): print('*' * i) for i in range(1,...

python的id()函数介绍

>>> a = 2.5>>> b = 2.5>>> c = b>>> a is cFalse>>>...