因此,我从github(https://github.com/numat/alicat)安装了alicat,以尝试使用我的Raspberry Pi控制alicat质量流量控制器。
我已按照说明进行操作,并创建了以下程序flow.py:
from alicat import FlowController
flow_controller = FlowController(port='/dev/ttyUSB0')
print(flow_controller.get())
运行此命令时,将收到以下响应:
Traceback (most recent call last):
File "flow.py", line 2, in <module>
flow_controller = FlowController(port='/dev/ttyUSB0')
File "/home/pi/.local/lib/python2.7/site-packages/alicat/serial.py", line 234, in __init__
FlowMeter.__init__(self, port, address)
File "/home/pi/.local/lib/python2.7/site-packages/alicat/serial.py", line 40, in __init__
self.connection = serial.Serial(port, 19200, timeout=1.0)
AttributeError: 'module' object has no attribute 'Serial'
似乎已经正确安装了alicat --help弹出帮助文件,还安装了pyserial。
有人可以帮忙吗?
谢谢!