使用pip将Python软件包安装到其他目​​录中吗? [英] Install a Python package into a different directory using pip?

查看:106
本文介绍了使用pip将Python软件包安装到其他目​​录中吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道显而易见的答案是使用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屋!

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