我想從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',它工作正常。如果那不是你所做的,你可以嘗試。 –