I know that when I install Python packages on Linux I need to use the --user option of pip to install the package in my home directory, otherwise I'll need root privilege. But on Windows it seems that whether or not I use this option, the package will always be installed in my home directory (C:\Users\{username}\...), but the specific path will be slightly different. With the --user option, the package will be installed to c:\users\{username}\appdata\roaming\python\python37\site-packages, while without this option the package will be installed to c:\users\{username}\appdata\local\programs\python\python37-32\lib\site-packages.
C:\>pip3 install pyyaml
Collecting pyyaml
Using cached https://files.pythonhosted.org/packages/45/19/53c041b8719eaf88ce1cdb51bea1c5a2844433e79c23a2a8aeeaa0e27fd8/PyYAML-5.1.1-cp37-cp37m-win32.whl
Installing collected packages: pyyaml
Successfully installed pyyaml-5.1.1
C:\>pip3 show pyyaml
Name: PyYAML
Version: 5.1.1
Summary: YAML parser and emitter for Python
Home-page: https://github.com/yaml/pyyaml
Author: Kirill Simonov
Author-email: xi@resolvent.net
License: MIT
Location: c:\users\{username}\appdata\local\programs\python\python37-32\lib\site-packages
Requires:
Required-by:
C:\>pip3 uninstall pyyaml
Uninstalling PyYAML-5.1.1:
Would remove:
c:\users\{username}\appdata\local\programs\python\python37-32\lib\site-packages\_yaml.cp37-win32.pyd
c:\users\{username}\appdata\local\programs\python\python37-32\lib\site-packages\pyyaml-5.1.1.dist-info\*
c:\users\{username}\appdata\local\programs\python\python37-32\lib\site-packages\yaml\*
Proceed (y/n)? y
Successfully uninstalled PyYAML-5.1.1
C:\>pip3 install --user pyyaml
Collecting pyyaml
Using cached https://files.pythonhosted.org/packages/45/19/53c041b8719eaf88ce1cdb51bea1c5a2844433e79c23a2a8aeeaa0e27fd8/PyYAML-5.1.1-cp37-cp37m-win32.whl
Installing collected packages: pyyaml
Successfully installed pyyaml-5.1.1
C:\>pip3 show pyyaml
Name: PyYAML
Version: 5.1.1
Summary: YAML parser and emitter for Python
Home-page: https://github.com/yaml/pyyaml
Author: Kirill Simonov
Author-email: xi@resolvent.net
License: MIT
Location: c:\users\{username}\appdata\roaming\python\python37\site-packages
Requires:
Required-by:
All the commands were run under a normal user, not Administrator.
So what is the use of pip's --user option on Windows? Is it necessary to use --user option whenever I install packages?