There is no single correct answer here, but we can offer some common observations.
- Some Linux distributions decided during the transition from Python 2 to Python 3 that
python
should always refer to Python 2, and the command to run Python 3 would be python3
with a 3 at the end. Now that Python 2 is becoming obsolete, this is being relaxed in some distros (i.e. now that they no longer ship Python 2 at all, the python
command can be allowed to point to Python 3, too), but this is going to continue to exist in some form for some time.
- Debian-based Linux distros have a mechanism called
update-alternatives
which lets you define which version of python
exactly will be linked to the system-wide standard /usr/bin/python
. There is similarly a set of alternatives for /usr/bin/python3
.
- If you have manually installed Python 3 somewhere, what works depends on where it was installed and whether that location is in your
PATH
. A common arrangement is to have Python 3.14.159 somewhere like /opt/python-3.14.159/bin/python3.14.159
and then rely on users who want to use this to create a symlink or alias to this binary so that they can simply call it python
(or python3
, or obviously also e.g. shirley
if they prefer that)
- If you have an interactive alias, function, or personal shell script in your
PATH
with either of these names, obviously that overrides any system-wide setting, and could basically do anything at all, including but not limited to running a specific version of Python, ideally with all the command line arguments intact and correctly quoted (/path/to/system-wide/default/python "$@"
) but obviously with no guarantees of any sort.
- On Windows, where many of these facilities don't exist, a common arrangement is for Python to be installed in
C:\python3.14.159\bin\Python.exe
; you then have to have C:\python3.14.159\bin
in your PATH
for the python
command to work. The installer lets you install the package anywhere, but if you just go with the defaults, this is what you commonly end up with. Because of the cumbersomeness of Windows, the standard install also includes a command py
which works around some of the rigidity of the platform to let you flexibly indicate which Python version exactly to run. There is usually not a separate python3
command, though users are of course free to create a CMD
file with that name to run Python (or play a video of Rick Astley performing his biggest hit if they so prefer).
To help us help you debug questions about your installation, you will commonly need to tell us exactly what you installed where and how, and show us the value of your PATH
. If you have relevant functions, aliases, or personal shell scripts which shadow the system-wide default ones, show them too. On Unix-based platforms, the type
and command
commands can be used to show what will be executed (many guidances will tell you to use which
or whereis
, but don't; now we have to guess which non-standard command you are using, and where it is going to look). The Windows command whereis
provides roughly the same functionality.
Don't call me Shirley, please.