flam3
flam3

Reputation: 2027

Pip --user installs package to Default user directory on Windows 10

I have a problem on Windows 10 where both Python 2.6 and 2.7 are installed.

python -m pip install myPack --no-index --find-links=. --user

When running this command with user AutoUser it installs myPack to Default user directory C:\Users\Default\Python\Python27\site-packages or C:\Users\Default\Appdata\Roaming\Python\site-packages instead C:\Users\Autouser\Appdata\Roaming\Python\site-packages


Path:

C:\ProgramData\Oracle\Java\javapath;C:\Python27\;C:\Python27\Scripts\;C:\Python26\;C:\Python26\Scripts;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;

Python version:

python --version
Python 2.7.13

Pip version:

python -m pip --version
Pip version: pip 9.0.1 from C:\Python27\lib\site-packages (python 2.7) 

Upvotes: 22

Views: 36932

Answers (4)

Mohit
Mohit

Reputation: 807

CMD Prompt non-administrator, installed for current user:

Location: C:\Users\myuser\AppData\Roaming\Python\Python311\Scripts

enter image description here

CMD Prompt as ADMINISTRATOR, installed for all users:

C:\Program Files\Python\Scripts

enter image description here

Upvotes: 0

Pepe
Pepe

Reputation: 37

Try running cmd as admin when installing

Upvotes: 1

flam3
flam3

Reputation: 2027

Unfortunately I had to fix the problem in production quickly, so I gave up and installed it without the --user option to c:/python27/... directory. I guess one of @DeltaMarine101 suggestions would help.

Upvotes: -3

DeltaMarine101
DeltaMarine101

Reputation: 753

You can try setting the install target with the --target option like so:

pip install --target=C:\Users\Autouser\Appdata\Roaming\Python\site-packages package_name

If that doesn't work, another option is to try using --install-option like this:

pip install --install-option="--prefix=$PREFIX_PATH" package_name

Finally, if all else fails, here's one more way to do it:

PYTHONUSERBASE=/path/to/install/to pip install --user

You can specify which python version to install the package for by using python2.x -m pip install ...

Hopefully one of these helps you! :)

Upvotes: 10

Related Questions