NB! Python on Linux OS: Debian (and possibly Ubuntu, Mint, and family). | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

NB! Python on Linux OS: Debian (and possibly Ubuntu, Mint, and family).

If you run Debian 8, even with backports, defaults to python 2.7. SL's course (this) is for 3. They're *not* backwards compatible. My four cents: 1) Call "python3 code.py" instead of "python code.py" 2) IDEs? Get the version of python3 from the python3 console, then use which, eg "which python3.4" in my case, to get the correct path for the IDE, "/usr/bin/python3.4" in my case. 3) Add the shebang to the top of your file, "#! /usr/bin/python3.4" in my case. 4) I don't advise altering $PYTHONPATH.

23rd May 2017, 8:53 PM
Jamie - avatar
2 Answers
+ 3
I've got both installed. As long as /usr/bin/python is 2.7 you should be fine. $PYTHONPATH may need to point to it too.
24th May 2017, 10:20 AM
Jamie - avatar
+ 1
The reason for that is that many build packages still rely on python 2.7. I found out the hard way by trying to install serialport module for nodejs. There is no way to do it if you have python 3.x installed (even alongside 2.7). If you happen to have it installed it (like I did) you have to remove it, remove gyp ,reinstall gyp and and npm: changing python path didn't work. Written like that seems easy but it was a long way throughout repositories. when I finally started believing my times width python 2.7 compatibility issues where over.....
24th May 2017, 3:04 AM
seamiki - avatar