Windows pip在错误的目录中安装库 [英] windows pip installing libraries in wrong directory

查看:83
本文介绍了Windows pip在错误的目录中安装库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7计算机上具有python 3.5,并且此计算机没有任何其他python版本.
pip随附python 3.5安装.

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.

我用pip安装了selenium

pip install selenium

它将库安装在**AppData\Local\VirtualStore\**Program Files (x86)\Python 3.5\Lib\site-packages\

但是像pycharm这样的IDE会查看C:\Program Files (x86)\Python 3.5\Lib\site-packages\

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

那是应该安装它的地方.

And that is where it should be installed.

由于此IDE无法识别库,因此我无法在IDE中获得任何帮助.

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

作为一种解决方法,我将该库复制到了所需的文件夹,并且可以正常工作,但是我想知道如何配置pip以便立即在C:\Program Files (x86)\Python 3.5\Lib\site-packages\

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\

推荐答案

我找到了解决方案. 感谢@edrw在-t标志上亮了点.

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

即使您使用-t标志放置了特定位置,它也仅安装在AppData目录中,原因是打开命令提示符时,它没有管理员权限.

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.

解决方案: 关闭命令提示符. 用以管理员身份运行"打开它 运行命令"pip install selenium"

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

它应该安装在正确的位置,原因是您需要管理员权限才能从Program Files(x86)文件夹中复制或删除文件.

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

这篇关于Windows pip在错误的目录中安装库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆