pip install 总是克隆 git repos 即使包已经安装 [英] pip install always clones git repos even if package is already installed

查看:24
本文介绍了pip install 总是克隆 git repos 即使包已经安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法让 pip 检查 git 指定的包是否已经安装并完全跳过 git 克隆?

Is there a way for pip to check if the git specified package is already installed and skip git cloning altogether?

文档提到可以在egg定义后指定版本,但这只是为了用户的视觉方便,不会在任何地方使用.

Documentation mentions that you can specify the version after the egg definition but that is only for the visual convenience of the user and is not used anywhere.

推荐答案

以防万一像我这样的菜鸟面临这个问题,重新克隆和重新构建包也可能发生,因为 URL 中的鸡蛋名称不正确.

Just in case another noob like me is facing this issue, the re-cloning and re-building of the package could also happen because the egg name in the URL is incorrect.

特别是,如果您的项目名为 project_name,pip 会将包(和鸡蛋)命名为 project-name,在构建过程中用连字符替换下划线.因此,您可能需要将 URL 更改为

Spcifically, if your project is called project_name, pip will name the package (and the egg) as project-name replacing the underscores with hyphens during the build process. So, you may need to change the URL from

git+https://example.com/project_name.git#egg=project_name

git+https://example.com/project_name.git#egg=project-name

查看 pip install ... 的输出会告诉你正在创建和使用的包名称.

Looking at the output of pip install ... will tell you the package name that is being created and used.

这篇关于pip install 总是克隆 git repos 即使包已经安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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