Reputation: 2266
I am using pip
as my package manager for Python on my Windows 11 machine. I always install all my packages to --user
. So, having to add --user
argument every time I install a package is kind of annoying since it's my desired default installation path already!
> pip install package1 package2 package3 --user
On Ubuntu, if sudo pip
is not used (which is recommended not to use it), pip install defaults to user
$ pip install package1 package2 package3
Defaulting to user installation because normal site-packages is not writeable
...
Is there any way to force pip to install packages to user by default as if --user
argument is added without explicitly appending it at the end?
I always add
--user --upgrade --verbose
to anypip install
command
Upvotes: 0
Views: 9218
Reputation: 347
You can look at the pip documentation here.
For the following to work you might have to go to File Explorer and at the top go to View and make sure you have selected hidden items from the options.
You will need to specify the default install location within a pip.ini file. Which, is usually located at %APPDATA%\local\pip\pip.ini(on Windows)
.
The %APPDATA%
is located in C:\Users\username
then go to AppData on Windows.
You may have to create the pip.ini
file when you find your pip directory. Within your pip.ini you will then need to put something like:
[global]
target=C:\Users\user
user being your username for your Windows machine.
Upvotes: 4