在raspberry Pi3中使用XBee python库时出错

时间:2018-06-12 02:47:35

标签: python raspberry-pi3 xbee

我想在raspberry pi中使用XBee python库。当我运行代码时,遇到以下错误

    Traceback (most recent call last):
       File "XBeeMQTT-V1.py", line 25, in <module>
       from digi.xbee.devices import XBeeDevice
       File "build/bdist.linux-armv7l/egg/digi/xbee/devices.py", line 22, in <module>
       File "build/bdist.linux-armv7l/egg/digi/xbee/serial.py", line 15, in <module>
    ImportError: cannot import name Serial

我在python代码中导入serial和xbee-digi,并在raspberry pi(usr / local / lib / python2.7 / dist-packages)上安装这两个库。 知道错误源于何处?

1 个答案:

答案 0 :(得分:1)

要解决此问题,请按以下步骤操作:

sudo apt-get install python3-pip && sudo apt-get install python3-serial

然后转到 /usr/local/lib/python3.x/dist-packages 并运行

sudo pip3 install setuptools

最后

sudo pip3 install digi-xbee