[英]Error importing from pyserial
I get a nameError when using Serial.使用 Serial 时出现 nameError。 I believe that i am not importing serial properly.
我相信我没有正确导入串行。
from serial import *
serialPort = Serial("COM3", 9600)
i've installed pyserial through pip.我已经通过 pip 安装了 pyserial。 Am i doing something wrong?
我做错了什么吗? Has anyone else experienced this error?
有没有其他人遇到过这个错误?
You called your file serial.py
, which will shadow the installed serial
module.您调用了文件
serial.py
,它将serial.py
已安装的serial
模块。 Rename your file to something else, then it should work.将您的文件重命名为其他名称,然后它应该可以工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.