使用pip将Python软件包安装到其他目录中吗? [英] Install a Python package into a different directory using pip?
问题描述
我知道显而易见的答案是使用virtualenv和virtualenvwrapper,但是由于种种原因,我不想/不想这样做.
I know the obvious answer is to use virtualenv and virtualenvwrapper, but for various reasons I can't/don't want to do that.
那我该如何修改命令
pip install package_name
要让pip
将软件包安装到默认site-packages
以外的其他地方?
to make pip
install the package somewhere other than the default site-packages
?
推荐答案
使用:
pip install --install-option="--prefix=$PREFIX_PATH" package_name
您可能还想使用--ignore-installed
强制使用此新前缀重新安装所有依赖项.您可以多次使用--install-option
来添加可以与python setup.py install
一起使用的任何选项(--prefix
可能是您想要的,但是您可以使用很多其他选项).
You might also want to use --ignore-installed
to force all dependencies to be reinstalled using this new prefix. You can use --install-option
to multiple times to add any of the options you can use with python setup.py install
(--prefix
is probably what you want, but there are a bunch more options you could use).
这篇关于使用pip将Python软件包安装到其他目录中吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!