Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

Is Python3 now standard on Debian 11 Bullseye?

Programming languages, Coding, Executables, Package Creation, and Scripting.
Post Reply
Message
Author
nigratruo
Posts: 22
Joined: 2017-08-12 22:46
Has thanked: 1 time

Is Python3 now standard on Debian 11 Bullseye?

#1 Post by nigratruo »

Hi,

I'm a little confused on what the status of the migration from Python 2 to 3 is.
I no longer have 2 installed and would like to migrate everything to Python 3, but when use python in CLI it says "command not found", isn't that supposed to default to Python 3?

User avatar
sunrat
Administrator
Administrator
Posts: 6477
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 474 times

Re: Is Python3 now standard on Debian 11 Bullseye?

#2 Post by sunrat »

Post the command and error message exactly.
The command "python" should now be a symlink to "python3" Check:

Code: Select all

$ file /usr/bin/python
/usr/bin/python: symbolic link to /usr/bin/python3
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

User avatar
ticojohn
Posts: 1284
Joined: 2009-08-29 18:10
Location: Costa Rica
Has thanked: 21 times
Been thanked: 44 times

Re: Is Python3 now standard on Debian 11 Bullseye?

#3 Post by ticojohn »

sunrat wrote: 2021-09-30 05:07 Post the command and error message exactly.
The command "python" should now be a symlink to "python3" Check:

Code: Select all

$ file /usr/bin/python
/usr/bin/python: symbolic link to /usr/bin/python3
Hey there @sunrat, not being in any way critical because you're way smarter than I, but I just did that on my Bullseye installation

Code: Select all

$ file /usr/bin/python
/usr/bin/python: cannot open `/usr/bin/python' (No such file or directory)
However this works

Code: Select all

$ file /usr/bin/python3
/usr/bin/python3: symbolic link to python3.9
I am not irrational, I'm just quantum probabilistic.

User avatar
sunrat
Administrator
Administrator
Posts: 6477
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 474 times

Re: Is Python3 now standard on Debian 11 Bullseye?

#4 Post by sunrat »

ticojohn wrote: 2021-10-01 19:25
sunrat wrote: 2021-09-30 05:07 Post the command and error message exactly.
The command "python" should now be a symlink to "python3" Check:

Code: Select all

$ file /usr/bin/python
/usr/bin/python: symbolic link to /usr/bin/python3
Hey there @sunrat, not being in any way critical because you're way smarter than I, but I just did that on my Bullseye installation

Code: Select all

$ file /usr/bin/python
/usr/bin/python: cannot open `/usr/bin/python' (No such file or directory)
However this works

Code: Select all

$ file /usr/bin/python3
/usr/bin/python3: symbolic link to python3.9
I'm pretty sure I didn't create that symlink and its creation date is the same as most of the other python files in /usr/bin/ so think it was created by the installer. I do recall creating it in a previous install a long time ago and it actually enabled a couple of python2 programs to run under python3.
So just create it. :wink:

Code: Select all

ln -s python3 python
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

nigratruo
Posts: 22
Joined: 2017-08-12 22:46
Has thanked: 1 time

Re: Is Python3 now standard on Debian 11 Bullseye?

#5 Post by nigratruo »

I should probably elaborate on the subject line and clarify the question:

Do you need python 2.x installed for a Debian 11 Bullseye system to still work properly? If no, then python2.x has been transitioned to 3.
I don't seem to have 2.x installed and it seems to work properly.
So using the command python might be deprecated and obsolete and to not accidentally get the python2 interpreter, all calls are now made via python3.
I don't know if this assumption is correct, that is why I'm asking.

User avatar
craigevil
Posts: 5391
Joined: 2006-09-17 03:17
Location: heaven
Has thanked: 28 times
Been thanked: 39 times

Re: Is Python3 now standard on Debian 11 Bullseye?

#6 Post by craigevil »

No you do not need python2.
Python3 is the default version of python on Bullseye.
Raspberry PI 400 Distro: Raspberry Pi OS Base: Debian Sid Kernel: 5.15.69-v8+ aarch64 DE: MATE Ram 4GB
Debian - "If you can't apt install something, it isn't useful or doesn't exist"
My Giant Sources.list

reinob
Posts: 1196
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: Is Python3 now standard on Debian 11 Bullseye?

#7 Post by reinob »

If you want python to be a symlink to python3 you need to apt install python-is-python3.
Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal)
releases, all python packages use explicit python3 or python2
interpreter and do not use unversioned /usr/bin/python at all. Some
third-party code is now predominantly python3 based, yet may use
/usr/bin/python.

This is a convenience package which ships a symlink to point
the /usr/bin/python interpreter at the current default python3. It may
improve compatibility with other modern systems, whilst breaking some
obsolete or 3rd-party software.
It's all slightly messy, but from what I can tell there are no traces of python2 left (at least in my desktop installation here).

User avatar
sunrat
Administrator
Administrator
Posts: 6477
Joined: 2006-08-29 09:12
Location: Melbourne, Australia
Has thanked: 118 times
Been thanked: 474 times

Re: Is Python3 now standard on Debian 11 Bullseye?

#8 Post by sunrat »

reinob wrote: 2021-10-06 06:16 If you want python to be a symlink to python3 you need to apt install python-is-python3.
Starting with the Debian 11 (bullseye) and Ubuntu 20.04 LTS (focal)
releases, all python packages use explicit python3 or python2
interpreter and do not use unversioned /usr/bin/python at all. Some
third-party code is now predominantly python3 based, yet may use
/usr/bin/python.

This is a convenience package which ships a symlink to point
the /usr/bin/python interpreter at the current default python3. It may
improve compatibility with other modern systems, whilst breaking some
obsolete or 3rd-party software.
That's what I posted above, except in a simple command rather than installing another package.
“ computer users can be divided into 2 categories:
Those who have lost data
...and those who have not lost data YET ”
Remember to BACKUP!

reinob
Posts: 1196
Joined: 2014-06-30 11:42
Has thanked: 99 times
Been thanked: 47 times

Re: Is Python3 now standard on Debian 11 Bullseye?

#9 Post by reinob »

sunrat wrote: 2021-10-06 06:45 That's what I posted above, except in a simple command rather than installing another package.
Yup, just wanted to clarify the reason for the missing /usr/bin/python.

Plus I'd recommend, generally, to do such things by installing the relevant package (if there is one) rather than by altering things in /usr/bin (as this might be overwritten by subsequent updates, etc.)

nigratruo
Posts: 22
Joined: 2017-08-12 22:46
Has thanked: 1 time

Re: Is Python3 now standard on Debian 11 Bullseye?

#10 Post by nigratruo »

craigevil wrote: 2021-10-06 01:01 No you do not need python2.
Python3 is the default version of python on Bullseye.
Thank you, that is what I was asking.

nigratruo
Posts: 22
Joined: 2017-08-12 22:46
Has thanked: 1 time

Re: Is Python3 now standard on Debian 11 Bullseye?

#11 Post by nigratruo »

reinob wrote: 2021-10-06 07:05
sunrat wrote: 2021-10-06 06:45 That's what I posted above, except in a simple command rather than installing another package.
Yup, just wanted to clarify the reason for the missing /usr/bin/python.

Plus I'd recommend, generally, to do such things by installing the relevant package (if there is one) rather than by altering things in /usr/bin (as this might be overwritten by subsequent updates, etc.)
yes and that is why we have package manager: They setup the system consistently and managable.

Post Reply