Wiki RaspberryPi installation

in the wiki

Step 4: Install PySerial

Install PySerial with the command sudo apt-get install python-serial

what should the command line be to get python serial version 3?

answered my own quesiton

after , sudo apt-get update

sudo pip install pyserial --upgrade

3 Likes

Are you saying do the “sudo pip install pyserial --upgrade” instead of “sudo apt-get install python-serial” or in addition to it?

in addition to it.
the sequence i used was

sudo apt-get install python-serial
sudo pip install pyserial --upgrade

Interesting. I have seen some instances where you can get yourself into trouble by installing a python package one way (e.g. apt-get) and then trying to upgrade it another way (e.g. pip). However I don’t know enough about the subject to know when that’s likely to be a problem. Anyone out there have more insight? Would something like this be safer?

python -m pip install pyserial
python -m pip install pyserial --upgrade

I don’t have a RasPi to test this on.

yes, stick to one or the other, mixing them can cause you to have two versions
installed, and depending on how things are run, you may get either one.

I strongly prefer to use the OS packages (apt or yum), but if you need a version
newer than the OS provides, it can be trickier to do than doing everything with
pip

So then my next questions/comments are:

  1. Should most RasPi users be using pyserial 3 or should that be an
    optional step in the wiki?
  2. My very brief research (
    https://raspberrypi.stackexchange.com/questions/68837/pyserial-error-on-raspberry-3)
    indicates that the pyserial repositories tend to not be up-to-date.
  3. Speaking of up-to-date, python 3 is finally starting to emerge as the
    preferred version. When do we make the switch? This may be part of a larger
    discussion across all OSs, but I thought I’d bring it up.

On the python 2 vs python 3 topic I actually started the project out in 3 but then went back to two. The hang up is that when I last checked the tools to compile to an executable for 3 weren’t quite working reliably yet. As soon as they are I support moving to three.

5 Likes