12

I initially had Python 2.7, which often comes bundled with the OS (currently using Linux Mint 12). I wanted to try Python 3, so I installed it alongside Python 2. All is fine there, and I can run both versions in the terminal by calling either python or python3.

However, there doesn’t seem to be any way to start IDLE with Python 3. Is there some flag that I can pass to IDLE when I start it so that I can pick which version of Python I would like it to run?

E.g. (these don't work), idle3 or idle --shell=python3 or something like that. I read about pointing to a different executable in this question about IDLE for Python 3 (on Vista). However, I can't seem to do the analogous thing on Linux.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Samuel Tan
  • 1,700
  • 5
  • 22
  • 35

6 Answers6

13

Just type sudo apt-get install idle3 in your terminal and IDLE for your version of Python 3 previously installed will be installed.

Then both are compatible. You run the 2.7 IDLE from your terminal by just typing idle. And you run the IDLE 3 version by just typing idle3 in the terminal. That worked for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
user1944489
  • 131
  • 1
  • 2
  • Short and sweet. It worked! Though the resulting executable for Python 3 using `sudo apt-get install idle3` was not `idle3`, but `idle` (at least on [Ubuntu 18.04](https://en.wikipedia.org/wiki/Ubuntu_version_history#Ubuntu_18.04_LTS_.28Bionic_Beaver.29) (Bionic Beaver)). It launched as IDLE 3.6.9 (Python 3.6.9), *"Python 3.6.9 Shell"*. It didn't install an executable by the name `idle3`: *"Command 'idle3' not found"* – Peter Mortensen Feb 23 '23 at 07:26
5

You'd have to install the appropriate package - Python 2.x and 3.x aren't compatible with each other.

You can find the link here.

Makoto
  • 104,088
  • 27
  • 192
  • 230
  • 1
    Thank you for that. I found the exectubale for idle in `/usr/bin`, one called `idle`, and another called `idle-python2.7`. So I tried `sudo apt-get install idle-python3.2`, and guess what? Problem solved! – Samuel Tan Aug 08 '12 at 02:58
3

I had to install python3-tools to get idle3 (using Fedora 18).

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Christy
  • 239
  • 2
  • 7
2

I installed IDLE using the following command:

sudo yum install python-tools.x86_64

And I can run both commands, and it gives me a Python 2 or Python 3 shell, respectively:

idle
idle3
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
iiiir.com
  • 325
  • 5
  • 9
1

Christy said:

"I had to install python3-tools to get idle3 (using Fedora 18)."

sudo yum install python3-tools

This also works on Fedora 19.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
0

In the case of Python 2, you can install it by running this command:

sudo apt-get install idle

And in the case of Python 3 you can install it by running this command:

sudo apt-get install idle3

This works fine for me.

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
  • Re *"This works fine for me."*: On what system? Linux? What distribution?`[Ubuntu](https://en.wikipedia.org/wiki/Ubuntu_%28operating_system%29)? What version? – Peter Mortensen Feb 23 '23 at 07:39