I am new to the Raspberry Pi, I have a project. I would like to work on Python 2 not Python 3.

By default Python 3 is installed on my Pi. I want to change or remove this version and I want to install Python version 2. the exact version does not matter, e.g. 2.7 or 2.9..etc.

Also I want to see Python version 2 on the menu in the programming list.

How do I do this?

  • Why do you want python 2? It would be more sensible to convert to python 3. – CoderMike Dec 2 at 17:24
  • i have some libraries and ready code in python 2. – Abdo Abdi Dec 2 at 17:28

You say you are using raspbian-stretch. With this and with most debian derivate you have python 2.7 installed. This is because the Debian operating system itself needs this version for its scripts to run. It is for historical reasons and because the maintainers haven't got it to upgrade all OS scripts to Python 3. I think they will do by time. If you call python (the default) - not python3 - on the command line you will run version 2.7. Check with

rpi ~$ python --version
Python 2.7.13
  • yes i can see this version of python(Python 2.7.13)in the terminal. but i want add this version the menu bar. – Abdo Abdi Dec 2 at 17:42
  • IDLE(2) is installed, but not activated in the menu. You can activate it again to get it back. Or just run idle from the command line. Personally I would use a different editor (e.g. mu, thonny, vscode or any of many available editors / IDEs) – Dirk Dec 2 at 19:44
  • how can i activate idle2. – Abdo Abdi Dec 4 at 15:01
  • @Dirk seems the previous comment is for you. – Ingo Dec 4 at 21:56
  • Thanks @Ingo. Added the procedure as a new answer. – Dirk Dec 4 at 22:12

Idle 2 is installed but on recent Raspbian images Python v2 menu entries are disabled.

To activate it start the 'Main Menu Editor' from the Preferences menu. Select 'Programming' on the left. After activating 'Python 2 IDLE' you should be able to start Idle 2 from the menu.

You may need to install the 'Main Menu Editor' program. For this use e.g.

sudo apt update
sudo apt install alacarte

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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