51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

为什么我在使用pip时一直收到这些错误,该如何解决?

英文:

Why do I keep receiving these errors when using pip, and how can I get it to work?

问题 {#heading}

每次我在终端(mac)中尝试运行pip install或pip3 install时,都会出现多个错误,提示:

警告:目标目录 [directory] 已存在。请使用 --upgrade 参数强制替换。

错误中显示的[directory]指向我安装的anaconda版本,但当我运行'which python3'时,我的python目录是:

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3

此外,当我运行pip list时,它显示:

警告:您正在使用pip版本22.0.3;然而,版本23.2.1可用。
您应考虑通过'/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install --upgrade pip'命令进行升级。

在这里,它指向的是python3.10而不是3.11。

每次我尝试使用给定的命令升级它时,它都不起作用,返回相同的警告,每次我尝试安装一个包时,它都不在列表中,尽管它会'完成安装'。

是什么导致了这个问题?我该如何解决?请帮忙,谢谢! 英文:

Every time I try to run pip install or pip3 install in terminal (mac), I get multiple errors saying

WARNING: Target directory [directory] already exists. Specify --upgrade to force replacement. 

the [directory] shown in the error points to the anaconda version I have, but my python directory when I run 'which python3' is:

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3

Also, when I run pip list, it gives:

WARNING: You are using pip version 22.0.3; however, version 23.2.1 is available.
You should consider upgrading via the '/Library/Frameworks/Python.framework/Versions/3.10/bin/python3 -m pip install --upgrade pip' command.

here, it points to python3.10 instead of 3.11.

Every time I try upgrade it with the given command, it just doesn't work and returns the same warning, and every time I try install a package it is not within the list, although it 'finishes installing'.

What is causing this? And how do I fix it? Please help. Thanks!!

答案1 {#1}

得分: 1

不要直接使用pip。使用python -m pip install ...,并确保正确的Python版本首先出现在PATH中使用绝对路径调用Python,例如

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -mpip 英文:

Don't use pip directly. Use python -m pip install ... and ensure that the correct python version is first in the PATH or invoke python with absolute path like

/Library/Frameworks/Python.framework/Versions/3.11/bin/python3 -mpip


赞(1)
未经允许不得转载:工具盒子 » 为什么我在使用pip时一直收到这些错误,该如何解决?