Hey guys, I have a quick question here,
I have Python 2 installed on my machine and I read a book on Python and Vega's great threads. However, my next book that I am about to read states that I need Python 3 to compile the code on their examples, I was wondering whether it is possible to have Python 2 and 3 on the same machine installed, or do I need to remove python 2 before installing 3?

I usually keep Python2 and Python3 on my Windows machine and you can do the same on a Linux computer. On Windows the trick is to tell your IDE which version to use. On Linux you can use the shebang line.

My $35 Raspberry Pi computer (Linux) came with both Python2 and Python3 installed, and from the desktop uses IDLE for Python2 and IDLE3 for Python3. Running Python code from the terminal you have to trust the shebang line. Make the first line in your code #!/usr/bin/python and it will use Python2.

Hopefully there will a time when we all use Python3.

Edited 1 Year Ago by vegaseat

Thanks vega,
I think that time will come =)

Just as information in case someone unders what I did (On Windows Machine right now)

installed both python2 and python3, directories that they are installed in are Python27 and Python34. I added both to the "path" of my machine, and since both have python.exe and pythonw.exe the word around is to rename the one you are not using. For example if you want to use python3's python.exe, just rename python.exe in python27 to something else such as "python2.exe"

I think both IDLE's should solve it too, thank you for that, didn't think of it :)

On Windows you can use these IDEs to switch between Python2 and Python3 ...
Ninja
PyCharm Community edition

Actually PyCharm comes with Portable Python 27
www.portablepython.com

This question has already been answered. Start a new discussion instead.