python - PIP 安装错误:不能同时设置 --home 和 --prefix

我没有在我的 pip install 命令中使用 --home 或 --prefix ,但是这个错误不允许安装 git repo。

error: subprocess-exited-with-error

  × pip subprocess to install build dependencies did not run successfully.
  │ exit code: 1
  ╰─> [8 lines of output]
      Collecting setuptools>=40.8.0
        Using cached setuptools-62.3.2-py3-none-any.whl (1.2 MB)
      Collecting wheel
        Using cached wheel-0.37.1-py2.py3-none-any.whl (35 kB)
      Installing collected packages: wheel, setuptools
      ERROR: Cannot set --home and --prefix together
      WARNING: You are using pip version 22.0.4; however, version 22.1 is available.
      You should consider upgrading via the 'C:\Users\Rizwan computers\AppData\Local\Programs\Python\Python310\python.exe -m pip install --upgrade pip' command.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.```


我在使用 Poetry 安装我们的依赖项的 VS Code Dev 容器中遇到了同样的问题。似乎是 中报告的 pip 本身的东西。

我最终删除了 .devcontainer/Dockerfile 中包含 PIP_TARGET 的所有行。我们的设置并不真正需要它们,因此更改效果很好。