安装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中利用numpy.array()实现俩个数值列表的对应相加方法

小编想把用python将列表[1,1,1,1,1,1,1,1,1,1] 和 列表 [2,2,2,2,2,2,2,2,2,2]对应相加成[3,3,3,3,3,3,3,3,3,3]。 代码如...

情人节快乐! python绘制漂亮玫瑰

情人节快乐! python绘制漂亮玫瑰

情人节快乐!这个节日怎么会少了浪漫的玫瑰花! 用Python的turtle库绘图是很简单的,画了一个玫瑰花,下面奉上源码: 源码: ''' Created on Nov 18, 2...

对python list 遍历删除的正确方法详解

在遍历list的时候,删除符合条件的数据,可是总是报异常,代码如下: num_list = [1, 2, 3, 4, 5] print(num_list) for i in ra...

python脚本作为Windows服务启动代码详解

我们首先来看下全部代码: # -*- coding: cp936 -*- import win32serviceutil import win32service import...

python实现动态数组的示例代码

实现一个支持动态扩容的数组并完成其增删改查 #通过python实现动态数组 """ 数组特点: 占用一段连续的内存空间,支持随机(索引)访问,且时间复杂度为O(1) 添加...