安装dbus-python的简要教程

yipeiwu_com5年前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使用ntplib库同步校准当地时间的方法

NTP(Network Time Protocol)是由美国德拉瓦大学的David L. Mills教授于1985年提出,设计用来在Internet上使不同的机器能维持相同时间的一种通讯...

Django 拆分model和view的实现方法

Django 拆分model和view的实现方法

在标准的dgango项目中,自动生成的目录结构会包括models.py和views.py两个文件,分别在里面写model的代码和controller的代码,但是所有的代码都写在一个文件里...

python的类方法和静态方法

本文实例讲述了python的类方法和静态方法。分享给大家供大家参考。具体分析如下: python没有和C++中static关键字,它的静态方法是怎样的呢?还有其它语言中少有的类方法又是神...

python操作oracle的完整教程分享

1. 连接对象 操作数据库之前,首先要建立数据库连接。 有下面几个方法进行连接。 >>>import cx_Oracle >>>db = cx_O...

Python Django切换MySQL数据库实例详解

准备 软件 版本 Django 2.1.3 Pytho...