以下命令从 git 存储库安装 Python 包:
$ pip install git+ssh://[email protected] /cdn-cgi/l/email-protection/username/repo.git
Collecting git+ssh://[email protected] /cdn-cgi/l/email-protection/username/repo.git
Cloning ssh://[email protected] /cdn-cgi/l/email-protection/username/repo.git to /tmp/pip-req-build-8s4nci15
我不是 100% 确定,但由于需要很长时间,我猜它会克隆每个提交。但对于安装,我只需要最新的。
相反,我想要一个浅克隆(带有--depth 1
)。那可能吗?
Adding --depth 1
to the git clone
命令有已被详细讨论 https://github.com/pypa/pip/issues/2432并暂时被拒绝pip
的维护者。这似乎是一个问题比人们想象的更复杂 https://github.com/pypa/pip/issues/2432#issuecomment-290936698,特别是因为它会打破setuptools_scm
被广泛使用。
正如克劳斯在评论中所说可以避免的开销git clone通过指向远程存档文件 https://pip.pypa.io/en/stable/reference/pip_install/#usage而不是使用 Git URL:
pip install http://my.package.repo/SomePackage-1.0.4.zip
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)