我已经用这个命令安装了一个库

pip install git+git://github.com/mozilla/elasticutils.git

直接从Github存储库安装.这很好用,我希望在我的requirements.txt中有这种依赖性.我看过其他this张这样的票,但这并没有解决我的问题.如果我把

-f git+git://github.com/mozilla/elasticutils.git
elasticutils==0.7.dev

requirements.txt文件中,pip install -r requirements.txt产生以下输出:

Downloading/unpacking elasticutils==0.7.dev (from -r requirements.txt (line 20))
  Could not find a version that satisfies the requirement elasticutils==0.7.dev (from -r requirements.txt (line 20)) (from versions: )
No distributions matching the version for elasticutils==0.7.dev (from -r requirements.txt (line 20))

documentation of the requirements file没有提到使用git+git协议说明符的链接,所以这可能只是不受支持.

有人能解决我的问题吗?

推荐答案

通常情况下,您的requirements.txt文件会如下所示:

package-one==1.9.4
package-two==3.7.1
package-three==1.0.1
...

要指定Github回购协议,不需要package-name==约定.

下面的示例使用GitHub repo更新了package-two.@#之间的文本表示包装的细节.

Specify commit hash (41b95ec in the context of updated requirements.txt):

package-one==1.9.4
git+https://github.com/path/to/package-two@41b95ec#egg=package-two
package-three==1.0.1

Specify branch name (master):

git+https://github.com/path/to/package-two@master#egg=package-two

Specify tag (0.1):

git+https://github.com/path/to/package-two@0.1#egg=package-two

Specify release (3.7.1):

git+https://github.com/path/to/package-two@releases/tag/v3.7.1#egg=package-two

请注意,#egg=package-two在这里不是注释,而是explicitly state the package name

This blog post对这个话题有更多的讨论.

Python相关问答推荐

这些变量是否相等,因为它们引用相同的实例,尽管它们看起来应该具有不同的值?

Python(Polars):使用之前的变量确定当前解决方案的Vector化操作

Django序列化器没有验证或保存数据

如何使用bs 4从元素中提取文本

如何使用Selenium访问svg对象内部的元素

在函数内部使用eval(),将函数的输入作为字符串的一部分

运行回文查找器代码时发生错误:[类型错误:builtin_index_or_system对象不可订阅]

Python多处理:当我在一个巨大的pandas数据框架上启动许多进程时,程序就会陷入困境

我在使用fill_between()将最大和最小带应用到我的图表中时遇到问题

如何将双框框列中的成对变成两个新列

带条件计算最小值

在Python Attrs包中,如何在field_Transformer函数中添加字段?

如何在polars(pythonapi)中解构嵌套 struct ?

无法定位元素错误404

多指标不同顺序串联大Pandas 模型

在单个对象中解析多个Python数据帧

使用Python从URL下载Excel文件

使用Python和文件进行模糊输出

解决调用嵌入式函数的XSLT中表达式的语法移位/归约冲突

如何使用两个关键函数来排序一个多索引框架?