Pip freeze给了我与git相关的错误

时间:2013-10-28 23:32:40

标签: python git heroku turbogears turbogears2

我正在使用python和git编写一个简单的Turbogears2项目,我只是为了好玩而构建的。在某个时刻我想将它部署到Heroku,所以我按常规pip freeze > requirements.txt进行操作,我收到此错误:

Error when trying to get requirement for VCS system Command /usr/bin/git config
remote.origin.url failed with error code 1 in /home/ricardo/myprojs/hellotg22/example,
falling back to uneditable format

在它生成的requirements.txt中,在所有依赖项之间列出,我发现这一行,看起来并不好看:

...
decorator==3.4.0
## !! Could not determine repository location
example==0.1dev
...

有没有人知道问题是什么?

无论如何,我已经设法获取了requirements.txt文件,但我想知道该错误是怎么回事。

3 个答案:

答案 0 :(得分:9)

您的git存储库没有“origin”,因此pip无法检测存储库的远程URL。这应该已经在PIP中修复,如https://github.com/pypa/pip/issues/58

中所述

尝试升级pip或将远程源添加到git存储库

答案 1 :(得分:6)

我在项目的可编辑安装(pip install -e .)中遇到此错误。所以我添加了一个localhost远程(git remote add origin git@localhost:the_project_name),现在pip freeze不再抱怨了。我从https://linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/

得到了这个想法

答案 2 :(得分:0)

尝试使用pip freeze -l,因为它也适用于虚拟环境。所以你的命令就是pip freeze -l > requirements.txt。我用它,它工作得很好。

根据帮助菜单:

Freeze Options:
  -l, --local                 If in a virtualenv that has global access, do not output globally-
                              installed packages.