安装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标准日志模块logging的使用方法

python标准日志模块logging的使用方法

最近写一个爬虫系统,需要用到python的日志记录模块,于是便学习了一下。python的标准库里的日志系统从Python2.3开始支持。只要import logging这个模块即可使用。...

Pycharm远程调试openstack的方法

Pycharm远程调试openstack的方法

Pycharm对openstack进行远程调试,供大家参考,具体内容如下 总共分三步: 一. 安装samba(非必须的) 二. 安装并配置pycharm 三. 修改openstack的代...

Python的几个高级语法概念浅析(lambda表达式闭包装饰器)

1. 匿名函数 匿名函数(anonymous function)是指未与任何标识符绑定的函数,多用在functional programming languages领域,典型应用场合:...

Python多线程编程(五):死锁的形成

前一篇文章Python:使用threading模块实现多线程编程四[使用Lock互斥锁]我们已经开始涉及到如何使用互斥锁来保护我们的公共资源了,现在考虑下面的情况– 如果有多个公共资源,...

用python求一重积分和二重积分的例子

首先是对一元函数求积分,使用Scipy下的integrate函数: from scipy import integrate def g(x): return (1-x**2)**...