PIP安装错误:无法同时设置--home和--prefix。

8
我没有在pip安装命令中使用--home或--prefix选项,但是这个错误不允许安装一个git仓库。
  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.```

你运行了什么命令导致出现这个错误? - larsks
我正在运行:python -m pip install git+https://github.com/mccoderpy/discord.py-message-components.git@developer。我能够在我的托管服务器上运行此命令。但是在我的个人电脑上,我不知道我对pip做了什么,它失败了。 - Technical Storm
请澄清您的具体问题或提供额外的细节,以准确突出您所需的内容。目前的描述不够清晰,很难确定您在询问什么。 - lpounng
4个回答

4

我在Windows 10上使用Python 3.7.3和pip 21.3.1时遇到了同样的问题。当我从pip\pip.ini中删除target后,问题得到解决。


1
谢谢,对我有用!如果有人想知道是否配置了pip.ini,可以运行命令pip config debug - Titou

0
可以通过以下方式解决: PIP_TARGET= pip install numpy

0
从@PApostol和@Titou的解决方案中得出我的解决方案。
unset PIP_TARGET

这就是我要做的一切,让错误消失了。从pip config debug中了解到了环境变量的情况。

0

我在使用 Poetry 安装依赖项的 VS Code Dev 容器中遇到了与 pip 有关的相同问题,正如 this issue 中所报告的那样。

最终,我删除了所有包含 PIP_TARGET 的行,因为我们的设置实际上并不需要它们,所以这个更改完全有效。


是的,这是pip config list的问题,我删除了所有配置,现在一切都正常了。 - Technical Storm

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接