4 ms·
The difference is implementation. GNU/Linux systems do not hijack the 'python' executable. If such an executable is on the path, they will use it. If Python is
by gizmo686 7y ago
The difference is implementation. GNU/Linux systems do not hijack the 'python' executable. If such an executable is on the path, they will use it. If Python is not installed a program can check the path and see that Python is not installed.
It is only when the user tries to run python on the terminal that the system (I presume the shell) detects that the program does not exist, and it then executes another program to inform the user.
If you put python as the #! interperator for a script, then bash will complain that interperator cannot be found.
If it is used as a command as part of a script, then bash does not call the normal command-not-found program (which advises you to install it), but just prints to stderr that the command was not found.
- WorldMaker 7y agoWindows doesn't "hijack" the python executable either. This stub should be a low priority in your PATH and the official Python installers should take higher priority when they install. It's basic PATH management, with much the same environment variable management issues on Linux as it is on Windows. It's unfortunate that so many machines that this poster is working with are getting malformed PATH variables with the priorities out of order, but it should be a simple fix to the PATH to correct. It should also probably be noted that the Microsoft/Windows Store installed version of Python is the official Python.org release. (It's CIed, and CDed directly from Python.org just as with any other release binary.)
- gizmo686 7y agoEven with correct PATH management, Windows still hijacks the command when python is not installed; that it the mechanism it uses to advise you to install it. Linux distributions use a different mechanism that maintain the expected behaviour of there not being any program/comnand called "python" when python is not installed. Windows solution in this case is a lazy hack that makes the system more brittle. As an aside, Linux distributions tend not to have this sort of PATH management issue because (for better or worse) they tend not to modify PATH when installing software.