This is actually part of the incentive for the change. Beginners have the incorrect intuition that installing a mutable (since pip needs to be able to install packages) into a read-only location (which is what installing as admin does) is a sensible thing to do then bombard other projects with bogus bug reports that they can’t install their packages because of permission errors.
That’s just Windows. os.getcwd() is nothing more than your current working directory — for applications launched through the desktop, the current working directory doesn’t make any sense but has to be set to something so Windows chooses the executable’s location[1] and macOS and Linux use the user’s home directory. In either case, it’s meaningless and not something code should use. IDEs like IDLE may change it to something more natural but it’s still broken code that relies on it.
Using __file__ was always the correct way to locate the current Python script. Depending on what you actually want that location for, that’s almost always still the correct thing to do even with pyinstaller.
Presumably you’re using the py launcher and it’s installed in
C:\Windows\System32. ↩︎