英文:
Why do I keep receiving these errors when using pip, and how can I get it to work?
问题
每次我在终端(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
不要直接使用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
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论