Change default python version in IDLE

9,533

If you need Python 2 just type idle in terminal.

If you need Python3 type idle3.

I have both Python2 and Python3 installed and also idle and idle3.

Share:
9,533

Related videos on Youtube

Stefano De Rosso
Author by

Stefano De Rosso

Updated on September 18, 2022

Comments

  • Stefano De Rosso
    Stefano De Rosso almost 2 years

    So, I'd like to have Python 2.7.6 when I open the IDLE (that is the one pre-installed on Ubuntu); instead, the idle opens with the one that I have installed (2.7.5). How can I do that?

  • Nodak
    Nodak over 9 years
    @StefanoDeRosso, you still have Python 2.7.6 installed, right?
  • Stefano De Rosso
    Stefano De Rosso over 9 years
    I have Python 2.7.6 installed, and when I run it from the terminal it is the default one. I've changed it to the default using the "ln" command. Anyway, I've came through the problem - even though in an "alternative" way -, by uninstalling and reinstalling the IDLE in Ubuntu Software Center. In any case I'd like to resolve it the other way, too.
  • Nodak
    Nodak over 9 years
    but when you execute /usr/bin/idle-python2.7, modified or not, from the command line the idle is 2.7.5?
  • Stefano De Rosso
    Stefano De Rosso over 9 years
    hey hey, executing "/usr/bin/idle-python2.7", it works! It opens the IDLE for Python 2.7.6. But is there some way to make it happen only writing "idle" on the terminal?
  • Nodak
    Nodak over 9 years
    Sure, the instructions are in /usr/lib/python2.7/idlelib prepend the parent of this idlelib dir to sys.path. Otherwise, importing idlelib gets the version installed with the Python used to call this module:`...or un-install 2.7.5
  • Stefano De Rosso
    Stefano De Rosso over 9 years
    Ugh, I don't know how, but it seems that there is no "idlelib" directory in Python 2.7.6; there is, instead, this directory in Python 2.7.5
  • Stefano De Rosso
    Stefano De Rosso over 9 years
    I don't know, maybe it means something that I have installed the 2.7.6 IDLE from the Software Center and not from the Terminal? Because its directory is "usr/bin/idle-python2.7"
  • Nodak
    Nodak over 9 years
    idlelib is in 2.7.5 because that was the version of Python into which it was installed. If you want to call up Idle from the terminal with just idle you must either remove it from 2.7.5, or remove 2.7.5 from your system. It can't be in both. It wouldn't know which way to go. But since you've essentially scabbed on 2.7.6 with a symbolic link either option is not as simple as it sounds.