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

Xar*_*Xar 6 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
Run Code Online (Sandbox Code Playgroud)

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

...
decorator==3.4.0
## !! Could not determine repository location
example==0.1dev
...
Run Code Online (Sandbox Code Playgroud)

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

无论如何,我已设法获取requirements.txt文件,但我想知道该错误发生了什么.

amo*_*mol 9

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

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

  • 但是添加遥控器,似乎已经解决了这个问题.谢谢! (2认同)

Rob*_*Rob 6

我在项目的可编辑安装(pip install -e .)中工作时遇到此错误.所以我添加了一个localhost remote(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/得到了这个想法