El Wess
Posts: 1
Joined: Tue May 14, 2019 2:23 pm

Which version of Phython is the default?

Tue May 14, 2019 2:27 pm

i have a raspberry pi 3 b+
when i write python --version
it tells me 2.7.13
when i write python3 --version
it tells me 3.5.3
which one is the default ?

User avatar
bensimmo
Posts: 3966
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: Which version of Phython is the default?

Tue May 14, 2019 3:08 pm

Both.
If you use python you get python2.x
If you use python3 you get python3.x
As you have found out

Going forward you'll want to use python3.

Things may change in the next version(s) of Raspbian and Debian change more and more code over to python3.

B.Goode
Posts: 7748
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Which version of Phython is the default?

Tue May 14, 2019 3:11 pm

Welcome to the Raspberry Pi forums.

El Wess wrote:
Tue May 14, 2019 2:27 pm
i have a raspberry pi 3 b+
when i write python --version
it tells me 2.7.13
when i write python3 --version
it tells me 3.5.3
which one is the default ?

(Expanding on what @bensimmo had said as I was typing this... )

As you have demonstrated, the default version of the Python interpreter that is invoked when you use python at a shell (command line) prompt is Python 2.7.13. That is also the version that is used by various system tools and utilities that rely on python.


But in attempt to encourage you to use the Python3 interpreter, if you select 'Python' from the Programming section of the Raspberry Pi Desktop GUI you will actually run the IDLE3 Python editor and IDE - that tool is written in, and invokes, the Python3 version of the interpreter, which as you have seen is currently (with Raspbian Stretch) Python 3.5.3 .

Return to “General discussion”