点冻结不显示需求文件的存储库路径 [英] Pip freeze does not show repository paths for requirements file

查看:95
本文介绍了点冻结不显示需求文件的存储库路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经创建了一个环境,并通过git添加了一个django-paramfield包:

I've created an environment and added a package django-paramfield via git:

$ pip install git+https://bitbucket.org/DataGreed/django-paramfield.git
Downloading/unpacking git+https://bitbucket.org/DataGreed/django-paramfield.git
  Cloning https://bitbucket.org/DataGreed/django-paramfield.git to /var/folders/9Z/9ZQZ1Q3WGMOW+JguzcBKNU+++TI/-Tmp-/pip-49Eokm-build
Unpacking objects: 100% (29/29), done.
  Running setup.py egg_info for package from git+https://bitbucket.org/DataGreed/django-paramfield.git
Installing collected packages: paramfield
  Running setup.py install for paramfield
Successfully installed paramfield
Cleaning up...

但是当我想创建需求文件时,我只会看到包名称:

But when i want to create a requirements file, i see only the package name:

$ pip freeze
paramfield==0.1
wsgiref==0.1.2

如何使其输出整个字符串git+https://bitbucket.org/DataGreed/django-paramfield.git而不是仅输出包名?该软件包不在PyPi中.

How can I make it output the whole string git+https://bitbucket.org/DataGreed/django-paramfield.git instead of just a package name? The package isn't in PyPi.

UPD :也许,它必须与setup.py做一些事情?我应该以某种方式更改它以反映回购网址吗?

UPD: perhaps, it has to do something with setup.py? Should I change it somehow to reflect repo url?

UPD2 :我发现了非常类似的

UPD2: I found quite a similar question in stackoverflow, but the author was not sure how did he manage to resolve an issue and the accepted answer doesn't give a good hint unfortunately, though judging from the author's commentary it has something to do with the setup.py file.

UPD3 :我试图通过setup.py中的download_url并通过带有该URL的pip安装软件包,但是他的问题仍然存在.

UPD3: I've tried to pass download_url in setup.py and installing package via pip with this url, but he problem persists.

推荐答案

一个简单但可行的解决方法是使用-e标志(如pip install -e git+https://bitbucket.org/DataGreed/django-paramfield.git#egg=django-paramfield)安装软件包.

A simple but working workaround would be to install the package with the -e flag like pip install -e git+https://bitbucket.org/DataGreed/django-paramfield.git#egg=django-paramfield.

然后pip freeze显示软件包的完整源路径.这不是应该以点子固定的最佳方法,但它可以正常工作.取舍-e(编辑标志)是pip将git/hg存储库克隆到/path/to/venv/src/packagename并运行python setup.py deploy,而不是将其克隆到temp dir,然后运行python setup.py install并在设置后删除temp dir.包装.

Then pip freeze shows the full source path of the package. It's not the best way it should be fixed in pip but it's working. The trade off -e (editing flag) is that pip clones the git/hg repo into /path/to/venv/src/packagename and run python setup.py deploy instead of clone it into a temp dir and run python setup.py install and remove the temp dir after the setup of the package.

这篇关于点冻结不显示需求文件的存储库路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆