当requirements.txt具有来自git的可编辑依赖项时,pip安装不起作用

问题描述

我有以下Pipfile,来自git有一个依赖项:

[packages]
requests = {editable = true,git = "https://github.com/requests/requests.git",ref = "v2.20.1"}

然后我跑步:

pipenv install
pipenv run pip freeze >requirements.txt

哪个生成requirements.txt

certifi==2020.6.20
chardet==3.0.4
idna==2.7
-e git+https://github.com/requests/requests.git@6cfbe1aedd56f8c2f9ff8b968efe65b22669795b#egg=requests
urllib3==1.24.3

现在可以正常使用:pipenv run pip install -r requirements.txt

但这不是:pipenv run pip install -r requirements.txt --target dist

错误

Installing collected packages: certifi,chardet,idna,urllib3,requests
  Attempting uninstall: requests
    Found existing installation: requests 2.20.1
    Uninstalling requests-2.20.1:
      Successfully uninstalled requests-2.20.1
  Running setup.py develop for requests
    ERROR: Command errored out with exit status 1:
     command: /Users/cahen/.local/share/virtualenvs/my-project-HJAU6iyr/bin/python -c 'import sys,setuptools,tokenize; sys.argv[0] = '"'"'/Users/cahen/.local/share/virtualenvs/my-project-HJAU6iyr/src/requests/setup.py'"'"'; __file__='"'"'/Users/cahen/.local/share/virtualenvs/my-project-HJAU6iyr/src/requests/setup.py'"'"';f=getattr(tokenize,'"'"'open'"'"',open)(__file__);code=f.read().replace('"'"'\r\n'"'"','"'"'\n'"'"');f.close();exec(compile(code,__file__,'"'"'exec'"'"'))' develop --no-deps --home /private/var/folders/1f/_zft4b3x3bb6nbc_rl4n_9zr0000gn/T/pip-target-nxsmebki
         cwd: /Users/cahen/.local/share/virtualenvs/my-project-HJAU6iyr/src/requests/
    Complete output (6 lines):
    usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
       or: setup.py --help [cmd1 cmd2 ...]
       or: setup.py --help-commands
       or: setup.py cmd --help

    error: option --home not recognized
    ----------------------------------------
  Rolling back uninstall of requests
  Moving to /Users/cahen/.local/share/virtualenvs/my-project-HJAU6iyr/lib/python3.8/site-packages/requests.egg-link
   from /private/var/folders/1f/_zft4b3x3bb6nbc_rl4n_9zr0000gn/T/pip-uninstall-iilp2si9/requests.egg-link
ERROR: Command errored out with exit status 1: /Users/cahen/.local/share/virtualenvs/my-project-HJAU6iyr/bin/python -c 'import sys,'"'"'exec'"'"'))' develop --no-deps --home /private/var/folders/1f/_zft4b3x3bb6nbc_rl4n_9zr0000gn/T/pip-target-nxsmebki Check the logs for full command output.

如果我删除editable = true,它将起作用,但是我需要对其进行编辑,以便按照here的描述将传递依赖项添加Pipfile.lock中。

所以我的问题是:当--target具有来自git的可编辑依赖性时,为什么requirements.txt标志不起作用?

我正在使用python 3.8.2和pip 20.2.2。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)