dbus не работает с python3 в виртуальной среде? - PullRequest
0 голосов
/ 16 февраля 2019

Я настроил виртуальную среду с именем «ComputerVision» с помощью virtualwrapper, virtualen и pthon3.

Все отлично работает, кроме импорта dbus в моем скрипте python.Я хочу использовать python3, но, как вы можете видеть: -dbus может быть важным с python2, а не python3 -cv2 может быть важным с python3, а не python 2

(ComputerVision) pi@raspberrypi:/ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39) 
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'dbus'
>>> import cv2
>>> exit()
(ComputerVision) pi@raspberrypi:/ $ python2
Python 2.7.13 (default, Sep 26 2018, 18:42:22) 
[GCC 6.3.0 20170516] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dbus
>>> import cv2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>> exit()
(ComputerVision) pi@raspberrypi:/ $ pip install dbus-python3
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting dbus-python3
  Could not find a version that satisfies the requirement dbus-python3 (from versions: )
No matching distribution found for dbus-python3
(ComputerVision) pi@raspberrypi:/ $ pip install python3-dbus
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python3-dbus
  Could not find a version that satisfies the requirement python3-dbus (from versions: )
No matching distribution found for python3-dbus
(ComputerVision) pi@raspberrypi:/ $ pip install python-dbus
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting python-dbus
  Could not find a version that satisfies the requirement python-dbus (from versions: )
No matching distribution found for python-dbus
(ComputerVision) pi@raspberrypi:/ $ 

Как это исправить, чтобы иметь возможность импортироватьdbus к моему скрипту на python3 ??

Заранее спасибо.

1 Ответ

0 голосов
/ 16 февраля 2019

Вам необходимо установить библиотеку dbus-python для Python3:

pip3 install dbus-python
...