Pip freeze给出了这个与gi相关的错误

2024-05-22 09:38:00 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在与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中,列出了所有依赖项,我发现这一行看起来一点都不好:

^{pr2}$

有人知道问题出在哪里吗?在

不管怎样,我已经设法得到了要求.txt文件,但我想知道这个错误是怎么回事。在


Tags: pipto项目gittxtheroku部署错误
3条回答

尝试使用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.

我在项目的可编辑安装(pip install -e .)中工作时遇到此错误。所以我添加了一个本地主机远程(git remote add origin git@localhost:the_project_name),现在{}不再抱怨了。我是从https://linuxprograms.wordpress.com/2010/05/10/how-to-set-up-a-git-repository-locally/那里得到这个主意的

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

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

相关问题 更多 >