python pip:强制安装忽略依赖项

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12759761/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-18 11:48:31  来源:igfitidea点击:

python pip: force install ignoring dependencies

pythonpip

提问by NeuronQ

Is there any way to force install a pip python package ignoring all it's dependencies that cannot be satisfied?

有没有办法强制安装 pip python 包而忽略所有无法满足的依赖项?

(I don't care how "wrong" it is to do so, I just need to do it, any logic and reasoning aside...)

(我不在乎这样做有多“错误”,我只需要这样做,抛开任何逻辑和推理......)

采纳答案by Jeff Tratner

pip has a --no-dependenciesswitch. You should use that.

pip 有一个--no-dependencies开关。你应该用那个。

For more information, run pip install -h, where you'll see this line:

有关更多信息,请运行pip install -h,您将在其中看到以下行:

--no-deps, --no-dependencies
                        Ignore package dependencies

回答by hamed baziyad

When I were trying install librosapackage with pip(pip install librosa), this error were appeared:

当我尝试librosa使用pip( pip install librosa)安装包时,出现此错误:

ERROR: Cannot uninstall 'llvmlite'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

I tried to remove llvmlite, but pip uninstallcould not remove it. So, I used capability of ignoreof pipby this code:

我试图删除llvmlite,但pip uninstall无法删除它。所以,我用的能力ignorepip这段代码:

pip install librosa --ignore-installed llvmlite

Indeed, you can use this rule for ignoring a package you don't want to consider:

实际上,您可以使用此规则来忽略您不想考虑的包:

pip install {package you want to install} --ignore-installed {installed package you don't want to consider}