使用requirements.txt安装本地python依赖项时出现128错误

时间:2021-02-25 09:45:20

标签: python git gitlab

我尝试使用 requirements.txt 文件安装本地 python 依赖项

我的需求.txt

<块引用>

-e git+ssh://git@ext.my_gitlab.com/my_group/my_project.git@master#egg=my_project

我遇到了这样的错误

<块引用>

警告:丢弃 git+ssh://@ext.my_gitlab.com/my_group/my_project.git@master#egg=my_project。命令出错,退出状态为 128: git clone -q 'ssh://@ext.my_gitlab.com/my_grouo/my_project.git' 'c:\polygon\projects\test_project\venv\src\my-project'。错误:无法对满足 my-project 要求的版本进行优化(不可用)。 ERORR:找不到与我的项目匹配的发行版(不可用)

然后我用这个命令安装本地依赖项,所有依赖项都安装没有任何错误

<块引用>

pip install -U git+ssh://git@ext.my_gitlab.com/my_group/my_project.git@master

如何通过requirements.txt安装解决这个问题? 我按照 https://pip.pypa.io/en/stable/reference/pip_install/#requirement-specifiers

中的说明进行操作

1 个答案:

答案 0 :(得分:1)

首先检查修改您的 requirements.txt 以在 URL 中包含 git@ 用户是否可行。

你说pip install -U git+ssh://git@ext.my_gitlab.com/...有效。
因此,requirements.txt 还应包括:

 git+ssh://git@ext.my_gitlab.com/
           ^^^

OP tibhar940 中的 the comments 报告:

<块引用>

那是我的错 - 我试过了

-e git+ssh://git@ext.my_gitlab.com:my_group/my_project.git@master#egg=my_project 

代替

-e git+ssh://git@ext.my_gitlab.com/my_group/my_project.git@master#egg=my_project