1

PySerial 3.4 will not importing with python 3.6.4. Also 3.5 or later. It works fine in python 2.7. Im out of ideas to try. Any help would be appreciated. In python 3.6.4, Error states: "module not found"

Pyserial is installed and should work with python 3.4 or later, based on website: https://pypi.python.org/pypi/pyserial.

Jakar510
  • 181
  • 3
  • 21

2 Answers2

1

First install pip3 that supports python3. Follow this for installations.

Then, install pyserial for python3 using pip3.

pip3 install pyserial

Once installed, run following code to test:

import sys
import serial

def main():
    print(sys.version) #check python version
    print(serial.__version__) #check pyserial version


if __name__ == '__main__':
    main()

My Output:

3.6.3 (default, Nov 30 2017, 15:06:08) 
[GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.38)]
3.4
Sumit Jha
  • 1,601
  • 11
  • 18
0

In addition to the answer from Sumit Jha, I had to do the following for Linux. On both Windows and Linux, I had to remove with pip remove pyserial and reinstall with pip3 install pyserial.

Step by step guide to install Python 3.6 and pip3 in Ubuntu

Download Python-3.6.1.tar.xz (or current version) from https://www.python.org/

Unzip the file and keep the folder in the home directory.

Open a terminal in that directory and perform the following commands:

  1. ./configure
  2. make
  3. make test
  4. sudo make install

This will install Python 3.6 but pip3 may not be working.Install necessary modules using:

sudo apt-get install libreadline-gplv2-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev

Now write the following to re-run the installation:

  1. sudo make
  2. sudo make install

Now you can install packages with Python 3.6 using pip3 command. For example: sudo pip3 install numpy

Jakar510
  • 181
  • 3
  • 21