11

I have python 3.5 on windows 7 machine and this machine does not have any other python version.
pip comes with python 3.5 installation.

I used pip to install selenium libraries

pip install selenium

It installed the library at:
AppData\Local\VirtualStore\Program Files (x86)\Python 3.5\Lib\site-packages\

But IDE like pycharm looks in:
C:\Program Files (x86)\Python 3.5\Lib\site-packages\

And that is where it should be installed.

Because of this IDE is not recognizing the library and I am not able to get any help in IDE.

As a workaround I copied the library to the desired folder and it is working, but I want to know how I can configure pip to right away install at C:\Program Files (x86)\Python 3.5\Lib\site-packages\

not2qubit
  • 14,531
  • 8
  • 95
  • 135
Sun Shine
  • 575
  • 2
  • 6
  • 20

4 Answers4

11

I got the solution. Thanks @edrw for throwing light on -t flag.

Even though you put the specific location using -t flag, it just installs in the AppData directory and the reason is when command prompt was open it was not with administrator privileges.

Solution: Close the command prompt. Open it with "Run as administrator" Run command "pip install selenium"

It should install at the correct location, reason is you need administrator permissions to copy or delete files from Program Files (x86) folder.

Sun Shine
  • 575
  • 2
  • 6
  • 20
  • 1
    This is a known regression in the 32-bit build of Python 3.5. See [issue 25213](http://bugs.python.org/issue25213). This problem is fixed in 3.5.1, which will be released this upcoming Sunday (6 Dec). You'll still need administrator privileges to install anything to "Program Files (x86)", but at least it will fail instead of silently doing the wrong thing. – Eryk Sun Dec 03 '15 at 12:05
6

You can append this path to sys.path in you python script or install package with -t flag which installs package into given dir. pip install selenium -t "C:\Program Files (x86)\Python 3.5\Lib\site-packages"

edrw
  • 91
  • 1
  • 2
  • 1
    For certain lib where they install executables into C:\path\to\python\Scripts\, this approach will make those exec's fail. A plain `pip install` won't have the issue. I had the problem with `poetry`. – kakyo Jul 19 '21 at 04:50
2

(I know the post is old. Answering cause I came across the same.)

You might have had previous Python installation at that location (AppData\Local\VirtualStore\**Program Files (x86)\Python 3.5\). I had similar issue, just different location. It got fixed once I fixed register variable HKEY_CLASSES_ROOT\Applications\python.exe\shell\open\command to proper location of Python interpreter e.g "C:\Python36\python.exe" "%1" %*

kk.
  • 3,747
  • 12
  • 36
  • 67
Ato
  • 31
  • 2
0

consider removing the --user switch and adding -t switch pointing to the desired path

pip install -r requirements.txt -t "C:\Python37\Lib\site-packages"