Python was originally installed in C:\Program Files\Python, but that changed around 1.5. What was the reasoning behind that decision? Is it a bad idea to change the directory back, and if so, why?
1 Answer
Apparently this is the cause of a 7-year discussion amongst Python developers.
The following rationale has been given by authors:
Author: Tim Peters (tim.peters) * (Python committer) Date: 2006-03-22 20:27
A long time ago, Python did install (by default) under "Program Files". I changed that, because of the endless problems created by the frickin' embedded space, and rarer but subtler problems due to "Program Files" not being a DOSish 8.3 name. Overall I still think it was a good change.
Note that, unlike most Windows applications (which are GUI-based), programming languages are intended to be used heavily from the command line, invoked by scripts, and so on. That's what makes a space in the path endlessly error-prone. In WinXP Pro, I noticed that MS was still careful to put its own command-line/script tools (sort.exe, ipconfig.exe, cscript.exe, ..., even notepad.exe) under pure DOSish 8.3 space-free paths ;-)
Aside: Due to the possibility of privilege escalation, using C:\ instead of C:\Program Files\ may be a security hazard:
Author: Mika Eloranta (mel) Date: 2005-09-07 21:34
The default installation target directory where Python is installation on Windows is directly under the system drive's root directory (e.g. "C:\python24"). The file and directory permissions inherited by the python24-directory from the root directory are not secure enough for keeping application binaries.
Microsoft has, in their infinite wisdom, decided that the root directory of the system drive should allow regular (non-admin) users to create directories and files there. This set of permissions is inherited by the python directory when it is created in the default location (i.e. "C:\python24" or whatever).
If you want to modify the Python directory to avoid the privilege escalation attack discussed, it should be possible to modify the \Python directory using icacls.
-
2almost no one calls python with its full path. The correct way is putting it's
bin
folder into%PATH%
and you won't need to deal with the spaces anymore. And it's not true that XP Pro has its command line executables in DOS 8.3 paths. While their paths generally don't have any spaces, many files have length longer than 8 characters like systeminfo.exe– phuclvJan 19, 2019 at 11:01