安装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解析xml文件实例分析

本文实例讲述了python解析xml文件的方法。分享给大家供大家参考。具体如下: python解析xml非常方便。在dive into python中也有讲解。 如果xml的结构如下:...

Python中logging.NullHandler 的使用教程

在使用 peewee 框架时,默认是不会出现日志消息的。 from peewee import Model, CharField, DateTimeField, IntegerFie...

Python 基础知识之字符串处理

Python字符串处理 字符串输入: my_string = raw_input("please input a word:") 字符串判断: (1) 判断是不是纯字母 my_...

Python编程使用*解包和itertools.product()求笛卡尔积的方法

本文实例讲述了Python编程使用*解包和itertools.product()求笛卡尔积的方法。分享给大家供大家参考,具体如下: 【问题】 目前有一字符串s = "['a', 'b']...

在 Python 应用中使用 MongoDB的方法

在这篇文章中,将向您展示如何使用Python链接目前主流的MongoDB(V3.4.0)数据库,主要使用PyMongo(v3.4.0)和MongoEngine(V0.10.7)。同时比较...