Issue 41376: site.getusersitepackages() incorrectly claims that PYTHONNOUSERSITE is respected (original) (raw)
The documentation for site.getusersitepackages() states at https://docs.python.org/3.10/library/site.html#site.getusersitepackages:
Return the path of the user-specific site-packages directory, USER_SITE. If it is not initialized yet, this function will also set it, respecting PYTHONNOUSERSITE and USER_BASE.
Yet the implementation does not agree:
$ python -c "import site; print(site.getusersitepackages())"
/home/user/.local/lib/python3.7/site-packages
$ PYTHONNOUSERSITE=1 python -c "import site; print(site.getusersitepackages())"
/home/user/.local/lib/python3.7/site-packages
(same result for -s and -I flags)