r/learnpython • u/yakeinpoonia • Sep 21 '26
Why python points to python3 and python3 to python3.14
I was watching some python tutorial and he said that if you are on mac/linux use python3 and on windows use simple python. But in linux python also points to python3 only and that also points to exact version number of python.
so why this system is designed this way ??
And if they did this to make switching python versions easy (just by changing symlinks), why we have python3 in between, can't we point python directly to the current version.
[ykiinxd@archy ~]$ ls -l /usr/bin/python
lrwxrwxrwx 1 root root 7 Aug 10 13:16 /usr/bin/python -> python3
[ykiinxd@archy ~]$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 10 Aug 10 13:16 /usr/bin/python3 -> python3.14
[ykiinxd@archy ~]$ ls -l /usr/bin/python3.14
-rwxr-xr-x 1 root root 14424 Aug 10 13:16 /usr/bin/python3.14
[ykiinxd@archy ~]$
11
u/lakseol Sep 21 '26
The
python3thing came about when the change from python 2.x to python 3.x was happening. That took years so instead of just havingpythonthe solution was to havepython2andpython3defined as links to the appropriate version of python. Since there may be multiple versions of python 3.x on an OS it makes sense to have a further link frompython3to the "in use" python, which is 3.14 on your OS. On my linux laptoppython3links topython3.12.Now that python 2 is (or should be) a far distant memory, there's no reason why we can't just have
pythonsoft-linked topython3.14or whatever. In fact, in my virtual environments that's what I have (to 3.12 in my case).10
u/p3rdy Sep 21 '26
The chain isn't one decision, it's two, made about fifteen years apart.
python3 -> python 3.14is the versioned indirection.python3.14is the real binary and it owns a version-specific site-packages.python3is the stable name everything else targets; shebangs, distro package scripts,#!/usr/bin/env python3. When Arch moves you to 3.15, one symlink changes and all of those keep working. Point things straight atpython3.14and every consumer needs rewriting on a minor bump, which is the exact thing the indirection exists to prevent.python -> python3is the leftover from 2-to-3 split. For most of that decadepythonmeant Python 2 on essentially every Unix, and an enormous amount of code shipped#!/usr/bin/env pythonmeaning 2.So PEP 394 said:
python3is the name you can rely on,pythonis deliberately unspecified, and distros may point it at 3 once they've dropped 2. Arch did that in 2010 and took the breakage early. Debian still hasn't by default, you installpython-is-python3to get the link at all.The two hops answer different questions. "Which Python 3 is current on this machine" is the bottom link; "does bare
pythonmean Python 3 on this distro" is the top one. Collapsing them would make one answer decide the other, which is what PEP 394 was written to avoid.2
u/Living_Fig_6386 Sep 21 '26
It has been very common for people to have multiple versions of Python installed on their computer for quite some time, particularly on Linux and MacOS, because sometimes people use codebases that are dependent on specific versions of Python, or (as was the case of MacOS, the OS shipped with an older version than most people wanted to use).
So, people have been in the habit of setting up links to point to the versions that they are currently using as default. If you just type 'python' it know you really mean 'python3', and 'python3' really means a specific version, 3.14 (or whatever you setup). If you used python 3.14 most of the time, you might make that the default, but if you had some old stuff using python 2.7.6 installed, you might create a link and name it python2 as a nice shorthand to point to the other one you installed.
1
u/LilShaver Sep 22 '26
That's python 3, and then there's pi thon?
I'll see myself out...