2

I'm developing a new application and my first in Python on the raspberry pi. Is there any disadvantage to using python 3.5 vs 2.7? The application will be strictly console not x11. Are all the modules available for 2.7 available for 3.5? [removed part about not being able to get latest version of pyserial using pip]

  • I believe there is some 3D graphics stuff that still only works with 2.7. – Darth Vader May 4 '16 at 6:52
1

I would have expected

sudo pip3 intall --upgrade pyserial

to install the latest version but, having just tested it on my RPi, I find it doesn't work! It may be a temporary glitch but pypi.python.org seems to have been abandoned by its maintainers in favour of its replacement 'warehouse' However there are issues with database sorting versions (checkout bitbucket) This seems a bad thing for anyone thinking of using python!!

You can get the latest pyserial by downloading from https://pypi.python.org/pypi/pyserial/3.0.1 unzipping and running

sudo python3 setup.py install

On the issue of python2 v. python3 I think any disadvantages will be small compared with the fact that sooner or later python2 will stop being maintained. Where modules exist for python2 but not for python3 it's a good indication that you should look elsewhere. (I recently struggled to make a pi3d demo using Gtk that would work nicely with python2 and python3. The fact that documentation and general info on the web is ancient made me realise that Qt would be a much better option)

  • lol I didn't realize I should be using pip3 for python3 but that makes sense. Boths pips intall pyserial 3.01. Another dfference I noticed is that the the ConfigParser module in 2.7 is now configparser in 3.5. It wasn't explicit in my op but I am new to python as well as the Pi so the disadvantage I see is that a lot of examples on the web use 2.7 syntax. But I'll deal with that as I have no legacy code to maintain. – dpetican May 5 '16 at 19:06
  • It might also be worth looking at 'Six' which has a good go at running the same code in python2 and pypthon3. pythonhosted.org/six/#module-six.moves – paddyg May 5 '16 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.