如何使用 `pip` 从 github link 安装额外要求
How to install extra-requires from a github link with `pip`
我有这个 python 包位于 github 存储库中。我可以像这样直接从 github link 安装它:
pip install git+https://github.com/mkdocs/mkdocs.git
我也想这样做,但要安装一些额外的依赖项。当只使用包名时,我们可以这样做:
pip install mkdocs[i18n]
但如果我尝试:
pip install git+https://github.com/mkdocs/mkdocs.git[i18n]
失败并出现以下错误:
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting git+https://github.com/mkdocs/mkdocs.git[i18n]
Cloning https://github.com/mkdocs/mkdocs.git[i18n] to /tmp/pip-req-build-1ykhyonq
Running command git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq
fatal: unable to access 'https://github.com/mkdocs/mkdocs.git[i18n]/': The requested URL returned error: 400
WARNING: Discarding git+https://github.com/mkdocs/mkdocs.git[i18n]. Command errored out with exit status 128: git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq Check the logs for full command output.
ERROR: Command errored out with exit status 128: git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq Check the logs for full command output.
如何使用 github links 的额外依赖项?
下面是 https://pip.pypa.io/en/stable/cli/pip_install/#examples 中的示例 7:
pip install "mkdocs[i18n] @ git+https://github.com/mkdocs/mkdocs.git"
“@”符号的用法在 PEP 440 的 direct references.
部分中有详细说明
这个有效:
pip install "git+https://github.com/mkdocs/mkdocs#egg=mkdocs[i18n]"
已添加 #egg=mkdocs
。
我有这个 python 包位于 github 存储库中。我可以像这样直接从 github link 安装它:
pip install git+https://github.com/mkdocs/mkdocs.git
我也想这样做,但要安装一些额外的依赖项。当只使用包名时,我们可以这样做:
pip install mkdocs[i18n]
但如果我尝试:
pip install git+https://github.com/mkdocs/mkdocs.git[i18n]
失败并出现以下错误:
Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com
Collecting git+https://github.com/mkdocs/mkdocs.git[i18n]
Cloning https://github.com/mkdocs/mkdocs.git[i18n] to /tmp/pip-req-build-1ykhyonq
Running command git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq
fatal: unable to access 'https://github.com/mkdocs/mkdocs.git[i18n]/': The requested URL returned error: 400WARNING: Discarding git+https://github.com/mkdocs/mkdocs.git[i18n]. Command errored out with exit status 128: git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq Check the logs for full command output.
ERROR: Command errored out with exit status 128: git clone -q 'https://github.com/mkdocs/mkdocs.git[i18n]' /tmp/pip-req-build-1ykhyonq Check the logs for full command output.
如何使用 github links 的额外依赖项?
下面是 https://pip.pypa.io/en/stable/cli/pip_install/#examples 中的示例 7:
pip install "mkdocs[i18n] @ git+https://github.com/mkdocs/mkdocs.git"
“@”符号的用法在 PEP 440 的 direct references.
部分中有详细说明这个有效:
pip install "git+https://github.com/mkdocs/mkdocs#egg=mkdocs[i18n]"
已添加 #egg=mkdocs
。