我想从Xbee接收数据到另一个连接到我的电脑(Windows 10)的Xbee。但我无法导入需要的xbee库。我安装librairy有: pip install xbee
ImportError:无法导入名称'XBee'
这里是我的代码:
import serial
from xbee import XBee
serial_port = serial.Serial('COM4', 9600)
xbee2 = XBee(serial_port)
while True:
try:
reponse = xbee2.wait_read_frame()
print (reponse)
except KeyboardInterrupt:
break
serial_port.close()
我把代码:https://python-xbee.readthedocs.io/en/latest/
以下是错误:
Traceback (most recent call last):
File "C:\Users\mis\Desktop\xbee.py", line 2, in <module>
from xbee import XBee
File "C:\Users\mis\Desktop\xbee.py", line 2, in <module>
from xbee import XBee
ImportError: cannot import name 'XBee'
有人能帮助我, 在此先感谢
我刚刚从Windows 10 Power Shell上安装了'pip install XBee',它工作正常。如果那不是你所做的,你可以尝试。 –