JavaEar 专注于收集分享传播有价值的技术资料

pySerial AttributeError: module 'serial' has no attribute 'Serial'

I have windows 7 64 bit and Python 3.6

I literally dig entire web for solving this - and nothing works sadly.

AttributeError                            Traceback (most recent call last)
<ipython-input-150-80ee8bd5f0f2> in <module>()
----> serial.Serial()

AttributeError: module 'serial' has no attribute 'Serial'

I tried solve this by: - checking if my file is named serial.py - reinstalling module - at first, entire module didn't work, now only it's functions. - I can't use any of its features, checking ports don't work, nothing works literally. - I checked my pip - everything is fine, module is in folder site-pacages. - If I execute some code inside pySerial files - it works. But there is no serial.Serial or connecting with COM ports (which I try to do.)

1个回答

    最佳答案
  1. I had the same problem with Python3 3.6.3.1 installed under Cygwin. I replaced 3.6.3.1 with 3.4.5.1 and the script worked again. OK, but not a good long term solution.

    Better solution: I reinstalled Python3 3.6.3.1, and then did "pip install pyserial", and then I was able to run my script. No additional modules show up when I do help("modules"), but something extra must have been added to serial.