使用PIP安装Git仓库的软件包时出现错误

4

我有一个老的Django项目需要现在部署。我需要安装与此项目中使用的确切版本相同的软件包。

在这个项目的requirements.txt文件中,有一些来自GIT仓库的软件包。

当使用 pip install -r requirements.txt 安装这些依赖时,会抛出以下错误。

  File "/home/nyros/Desktop/new/rmkenv/local/lib/python2.7/site-packages/pip/req.py", line 70, in __init__
    req = pkg_resources.Requirement.parse(req)
  File "/home/nyros/Desktop/new/rmkenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2606, in parse
    reqs = list(parse_requirements(s))
  File "/home/nyros/Desktop/new/rmkenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2544, in parse_requirements
    line, p, specs = scan_list(VERSION,LINE_END,line,p,(1,2),"version spec")
  File "/home/nyros/Desktop/new/rmkenv/local/lib/python2.7/site-packages/pip/_vendor/pkg_resources.py", line 2512, in scan_list
    raise ValueError("Expected "+item_name+" in",line,"at",line[p:])
ValueError: ('Expected version spec in', 'django_filebrowser-origin/HEAD', 'at', '/HEAD')

Storing debug log for failure in /home/nyros/.pip/pip.log

我认为问题出在 requirements.txt 文件中的 git url 上。请检查以下 requirements.txt 文件并告诉我哪些地方需要修改以安装依赖。
-e hg+https://bitbucket.org/descent/django-aloha@844a88f99fba4fd3e29771fe85d6c611e66cd2e5#egg=django_aloha-dev

-e git+https://github.com/Bouke/django-filebrowser-no-grappelli.git@a367570e795288281be303f7c2505803f7a48543#egg=django_filebrowser-origin/HEAD



-e git+https://github.com/toastdriven/django-haystack.git@4d90d7d6c77ebf7ee298f2de941b1f41d99caf1d#egg=django_haystack-master



-e git+https://github.com/jowolf/django-ide.git@a2aa7a8ae41298c4635ba6c8c3b634a130c653d9#egg=django_ide-master

-e git+https://github.com/bread-and-pepper/django-userena.git@5beff3929f261694f9af03f940e500586e2a60d3#egg=django_userena-origin/HEAD



-e git+https://github.com/pythonforfacebook/facebook-sdk@a12457671d3cb6265c52d9e8ef1ea2b387299fe3#egg=facebook_sdk-master

尝试将URL中的https替换为git!还要检查这些存储库是否仍然存在! - Mudassir Razvi
我尝试了,没用的,@MudassirRazvi - RMK
这些代码库存在,但是 @ 提交记录不存在。 - RMK
2
-e git+https://github.com/Bouke/django-filebrowser-no-grappelli.git@a367570e795288281be303f7c2505803f7a48543#egg=django_filebrowser-origin/HEAD尝试从URL中删除/HEAD。 - Hevlastka
我认为@serakiel是正确的。具体来说,从每个URL末尾删除“/HEAD”,其中包含“#egg=”部分。 - Chris
1个回答

2
从github导入特定提交的表单不需要https,也不需要在您的导入末尾加上/HEAD。请参考以下导入django开发分支的示例:
-e git://github.com/django/django.git@8568e7cfa4fb87cd0a9ead1b3fbb7a39d19e98b9#egg=django

移除那些部分,看看是否能解决你的问题。


如果这对您解决了问题感到满意,请随意打勾标记。 - Pythagoras
谢谢您的回答,但我的问题是关于git url末尾的/HEAD。 - RMK
是的。而且在我的回答中,“也不需要在导入的末尾加上/HEAD。”这不是你所需要的吗? - Pythagoras
1
是的,抱歉@Pythagoras,我错过了你评论中的/head,我接受了你的答案,谢谢。 - RMK

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接