有没有办法强制安装一个pip python包,忽略它所有不能满足的依赖关系?

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


PIP有一个——无依赖开关。你应该利用它。

要了解更多信息,运行pip install -h,在那里你会看到这一行:

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

当我尝试用pip安装librosa包(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.

我试图删除llvmlite,但pip卸载无法删除它。因此,我通过下面的代码使用了忽略pip的能力:

pip install librosa --ignore-installed llvmlite

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

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

试试下面的方法:

pip install --no-deps <LIB_NAME>

or

pip install --no-dependencies <LIB_NAME>

or

pip install --no-deps -r requirements.txt

or

pip install --no-dependencies -r requirements.txt