安装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装饰器与闭包

闭包是Python装饰器的基础。要理解闭包,先要了解Python中的变量作用域规则。 变量作用域规则 首先,在函数中是能访问全局变量的: >>> a = 'glob...

举例详解Python中循环语句的嵌套使用

 Python编程语言允许在一个循环内嵌套另一个循环。下面将介绍几个例子来说明这一概念。 语法 在Python中嵌套循环语句的语法如下: for iterating_var...

Python中map和列表推导效率比较实例分析

本文实例讲述了Python中map和列表推导效率比较。分享给大家供大家参考。具体分析如下: 直接来测试代码吧: #!/usr/bin/env python # -*- coding...

对python判断ip是否可达的实例详解

python中使用subprocess来使用shell 关于threading的用法 from __future__ import print_function import sub...

python使用PIL模块获取图片像素点的方法

如下所示: from PIL import Image ########获取图片指定像素点的像素 def getPngPix(pngPath = "aa.png",pixelX =...