如何更改pip安装路径 [英] How to change pip installation path
问题描述
我正在使用Mac.我的点安装路径为/Library/Python/2.7/site-packages
.如何将其更改为~/anaconda/lib/python2.7/site-packages/
?
I am using Mac. My pip installation path is /Library/Python/2.7/site-packages
. How do I change it to ~/anaconda/lib/python2.7/site-packages/
?
通常,在我的jupyter笔记本电脑中找不到pip安装的软件包,这就是为什么我要更改路径的原因.
Oftentimes, the package installed by pip won't be found by my jupyter notebook and that's why I want to change the path.
感谢您的帮助.欢迎使用其他用于正确安装软件包的解决方案.
I appreciate your help. Other solutions for correctly installing packages are welcome.
推荐答案
您可以告诉pip在哪里安装软件包.使用-t
标志,这意味着您要在其中安装软件包的目标目录.看看pip install --help
You can tell pip where to install the package. Use the -t
flag , that means the target directory where you want to install the package. Have have look at pip install --help
-t, --target <dir> Install packages into <dir>. By default this will not replace existing
files/folders in <dir>. Use --upgrade to replace existing packages in <dir> with
new versions.
您可以通过更改 pip.ini 配置文件来永久更改此设置.详情请参见: pip安装路径
You can change this on permanent basis by changing the pip.ini configuration file. See this for detail: pip install path
在Unix和Mac OS X上,配置文件为:
On Unix and Mac OS X the configuration file is:
$HOME/.pip/pip.conf
在Windows上,配置文件为:%HOME%\ pip \ pip.ini %HOME%位于
On Windows, the configuration file is: %HOME%\pip\pip.ini The %HOME% is located in
C:\Users\Bob on windows assuming your name is Bob
找到pip目录时,可能必须创建pip.ini文件.然后,您需要在pip.ini或pip.config中放入(假设在Windows上)类似
You may have to create the pip.ini file when you find your pip directory. Within your pip.ini or pip.config you will then need to put (assuming your on windows) something like
[global]
target=C:\Users\<username>\Desktop
这篇关于如何更改pip安装路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!