这是 req.in 文件(用于pip-compile)中的一行,用于从 github 存储库获取包:
-e git://github.com/dfrankow/django-editorjs-fields.git#egg=django-editorjs-fields
跑步pip-compile req.in
给出了一个req.txt
with
-e git+git://github.com/dfrankow/django-editorjs-fields.git#egg=django-editorjs-fields
使用pip
安装 ( pip install -r req.txt
) 会出现此错误:
ERROR: Command errored out with exit status 1:
command: .../.venv/bin/python -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'.../.venv/src/django-editorjs-fields/setup.py'"'"'; __file__='"'"'.../.venv/src/django-editorjs-fields/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' develop --no-deps
cwd: .../.venv/src/django-editorjs-fields/
Complete output (3 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'setuptools'
我安装了 setuptools(实际上是所有其他库)。看,没有错误:
$ .venv/bin/python -c 'import io, os, sys, setuptools, tokenize;'
$
如果我直接安装(没有-e
)它可以工作:
$ pip install git+git://github.com/dfrankow/django-editorjs-fields.git#egg=django-editorjs-fields
... (works)
但是当我-e
退出时req.in
,pip-compile
抱怨:
$ pip-compile req.in
...
pip._internal.exceptions.InstallationError: Invalid requirement: 'git://github.com/dfrankow/django-editorjs-fields.git#egg=django-editorjs-fields' (from line 1 of req.in)
Hint: It looks like a path. File 'git://github.com/dfrankow/django-editorjs-fields.git#egg=django-editorjs-fields' does not exist.
什么鬼,我被困住了。
如何将 github repo 放入 req.in,用 pip-compile 编译成 req.txt,然后 pip install req.txt 没有错误?
我需要它自动工作,因为我们有一个依赖它的工具链(github 工作流、dependabot 等)。
我在 OS X 上使用 python 3.9.1_2、pip 21.1.2、pip-tools 6.2.0。 pip-tools 6.0.1 也发生过(不足为奇)。