pip 安装 dbus-python 失败

Ali*_*ice 6 python-3.x

我计划安装dbus-python

$ pip --version; python --version
pip 19.0.3 from /home/me/anaconda3/lib/python3.7/site-packages/pip (python 3.7)   
Python 3.7.3
Run Code Online (Sandbox Code Playgroud)

该平台:

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 18.10
Release:    18.10
Codename:   cosmic
Run Code Online (Sandbox Code Playgroud)

当我运行时pip install dbus-python,它报告以下错误:

  checking for DBUS... no
  configure: error: in `/tmp/pip-install-hr9djbwg/dbus-python/build/temp.linux-x86_64-3.7':
  configure: error: The pkg-config script could not be found or is too old.  Make sure it
  is in your PATH or set the PKG_CONFIG environment variable to the full
  path to pkg-config.
  
  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.
Run Code Online (Sandbox Code Playgroud)

查看

$ echo $PKG_CONFIG
#return nothing 
Run Code Online (Sandbox Code Playgroud)

pkg-config我刚刚安装:

$ pkg-config --version
0.29.1
Run Code Online (Sandbox Code Playgroud)

它仍然报告这些错误:

  checking for DBUS... no
  configure: error: Package requirements (dbus-1 >= 1.8) 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.
Run Code Online (Sandbox Code Playgroud)

但是,dbus-1无法安装该包:

$ pip install dbus-1
Collecting dbus-1
  Could not find a version that satisfies the requirement dbus-1 (from versions: )
No matching distribution found for dbus-1
Run Code Online (Sandbox Code Playgroud)

小智 11

首先我查找包裹

sudo apt-cache search dbus-1
Run Code Online (Sandbox Code Playgroud)

然后我使用命令安装了所需的包:

sudo apt install libdbus-1-3 libdbus-1-dev
Run Code Online (Sandbox Code Playgroud)


小智 8

遇到了同样的问题。dbus-python似乎是一个已弃用的模块。dbus-next似乎是它的替代品。

pip install dbus-next
Run Code Online (Sandbox Code Playgroud)