安装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使用ddt过程中遇到的问题及解决方案【推荐】

python使用ddt过程中遇到的问题及解决方案【推荐】

前言: 在使用DDT数据驱动+HTMLTestRunner输出测试报告时遇到过2个问题: 1、生成的测试报告中,用例名称后有dict() -> new empty dictiona...

Python字符转换

如:>>> print ord('a')  97  >>> print ...

Python的条件语句与运算符优先级详解

Python的条件语句与运算符优先级详解

Python 条件语句 Python条件语句是通过一条或多条语句的执行结果(True或者False)来决定执行的代码块。 可以通过下图来简单了解条件语句的执行过程: Python程序...

在PyCharm中三步完成PyPy解释器的配置的方法

在PyCharm中三步完成PyPy解释器的配置的方法

介绍方法之前,我们先说说Python的解释器,由于Python是动态编译的语言,和C/C++、Java或者Kotlin等静态语言不同,它是在运行时一句一句代码地边编译边执行的,而Java...

python获取豆瓣电影简介代码分享

复制代码 代码如下:#!/usr/bin/env python#coding:utf-8import re,sysimport urllibfrom bs4 import Beautif...