WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: pyserial in python3.6  (Read 2243 times)

Offline JonHylands

  • Newbie
  • *
  • Posts: 2
pyserial in python3.6
« on: November 17, 2020, 09:01:35 PM »
Hi everyone,

First post here, I'm trying to set up piCore on a rpi zero w, and I need to access a usb-based serial port. I see there is support for pyserial in python 2, but all my robot code (which I've already written) runs in python 3. I'm running piCore 9.0.3.

What is the easiest way to get pyserial available in python 3.6?

Thanks,
Jon

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: pyserial in python3.6
« Reply #1 on: November 18, 2020, 04:03:11 AM »
You can compile pyserial for python3.6 in piCore-9.x with:
Code: [Select]
$ tce-load -i compiletc python3.6-dev
$ wget https://github.com/pyserial/pyserial/archive/v3.4.tar.gz
$ tar xf v3.4.tar.gz
$ cd pyserial-3.4
$ python3.6 setup.py build
$ sudo python3.6 setup.py install --root=/tmp/pkg

..and then make an extension out of the files under /tmp/pkg
« Last Edit: November 18, 2020, 04:06:07 AM by Juanito »

Offline JonHylands

  • Newbie
  • *
  • Posts: 2
Re: pyserial in python3.6
« Reply #2 on: November 18, 2020, 01:23:27 PM »
..and then make an extension out of the files under /tmp/pkg

I managed to build & install, but this part has me scratching my head a bit. The instructions I've found seem overly complex. Are there clear instructions anywhere?

Thanks,
Jon

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14849
Re: pyserial in python3.6
« Reply #3 on: November 18, 2020, 02:03:04 PM »
Code: [Select]
...
$ cd /tmp
$ tce-load -i squashfs-tools
$ sudo mksquashfs pkg/ py3.6serial.tcz