可以在VS代码中使用更新PIP。说{Update'update'}

发布于 2025-01-29 20:33:58 字数 2337 浏览 3 评论 0原文

OS:Win10

环境:Visual Studio代码

我要实现的目标:更新PIP从22.0.4到22.1

我尝试并获得的内容:

  1. Python -M PIP Install -– Upgrade Pip

get:

python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, 
or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python -m pip install -–upgrade pip
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
  1. sudo PIP3安装 - 升级PIP

get:

sudo : The term 'sudo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or    
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ sudo pip3 install --upgrade pip
+ ~~~~
    + FullyQualifiedErrorId : CommandNotFoundException
  1. pip Update

get:

ERROR: unknown command "update"
  1. 检查python是否安装在此位置:
  py -3  -  version
 

获取:

Python 3.10.4
  1. 检查是否在此位置安装了PIP:

pip -version

获取

> pip 22.0.4 from
> C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\pip
> (python 3.10)
  1. 使用“ python3”而不是“ python”

python3 -m pip install -– upgrade pip

get:

> > `python3 : The term 'python3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
> of the  name, or if a path was included, verify that the path is
> correct and try again. At line:1 char:1
> + python3 -m pip install -–upgrade pip
> + ~~~~~~~
>     + CategoryInfo          : ObjectNotFound: (python3:String) [], CommandNotFoundException
>     + FullyQualifiedErrorId : CommandNotFoundException`

问题:我无法在VS代码中更新PIP,我还应该尝试或检查什么?

OS: Win10

Environment: Visual Studio code

What I want to achieve: Update pip from 22.0.4 to 22.1

What I tried and get:

  1. python -m pip install -–upgrade pip

get:

python : The term 'python' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, 
or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python -m pip install -–upgrade pip
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (python:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
  1. sudo pip3 install --upgrade pip

get:

sudo : The term 'sudo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or    
if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ sudo pip3 install --upgrade pip
+ ~~~~
    + FullyQualifiedErrorId : CommandNotFoundException
  1. pip update

get:

ERROR: unknown command "update"
  1. check if python installed in this location:
py -3 --version

get:

Python 3.10.4
  1. check if pip installed in this location:

pip --version

get

> pip 22.0.4 from
> C:\Users\Username\AppData\Local\Programs\Python\Python310\lib\site-packages\pip
> (python 3.10)
  1. use "python3" instead of "python"

python3 -m pip install -–upgrade pip

get:

> > `python3 : The term 'python3' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling
> of the  name, or if a path was included, verify that the path is
> correct and try again. At line:1 char:1
> + python3 -m pip install -–upgrade pip
> + ~~~~~~~
>     + CategoryInfo          : ObjectNotFound: (python3:String) [], CommandNotFoundException
>     + FullyQualifiedErrorId : CommandNotFoundException`

Problem: I can't update pip in VS code, what else should I try or check?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

微凉 2025-02-05 20:33:58

你真的很近。根据您的错误,这应该有效:

py -3 -m pip install --upgrade pip

pip install --upgrade pip

确保在管理员命令提示符中运行此操作。右键单击CMD,然后选择“作为管理员运行”。这将避免权限错误。

为什么您的其他选项不起作用

  1. Python -M PIP Install -– -upgrade Pip:由于Python的安装为py -3而不是python。
  2. sudo pip3 install -upgrade pip。 sudo是linux唯一命令
  3. pip Update。更新不是PIP命令。您为什么不在此处使用安装-Upgrade Pip?该错误显示PIP已安装并称为PIP,因此可以正常工作。
  4. Python3 -M PIP安装 - - 杯pip。 python也不称为python3,而是py -3。总体而言,py -x语法是在Windows上获取Python的最可靠方法。

什么是py -3

py -3是找到Python的Windows实用程序。它的通用性非常多,例如,您可以键入py -3.9才能获得专门的3.9版本。

You are really close. Based on your errors this should work:

py -3 -m pip install --upgrade pip

Or

pip install --upgrade pip

Make sure to run this in a administrator command prompt. Right click cmd and select "run as administrator". This will avoid permission errors.

Why your other options don't work

  1. python -m pip install -–upgrade pip: Doesn't work since python is installed as py -3 not as python.
  2. sudo pip3 install --upgrade pip. Sudo is a linux only command
  3. pip update. update is not a pip command. Why didn't you just use install --upgrade pip here? The error shows pip is installed and called pip so that would work.
  4. python3 -m pip install -–upgrade pip. Python isn't called python3 either, but py -3. Overall the py -x syntax is the most reliable way to get python on windows.

What is py -3

py -3 is a windows utility that finds python. It's pretty versatile, for example you can type py -3.9 to get specifically the 3.9 version.

筱果果 2025-02-05 20:33:58

如果在Linux上,如果在Windows或终端上,您可以尝试使用CMD/PowerShell。只需粘贴相同的命令,并尝试它

希望

如果它不起作用,我认为您还没有将Python/pip添加到路径上。

You can try to use a cmd/powershell if on windows or terminal if on linux. Just paste the same command and try it

Hope it helps

If it doesn't work i think that you haven't added python/pip to path.

别念他 2025-02-05 20:33:58

我建议为此尝试CMD,如果仍然不起作用,请尝试在系统变量中添加Python路径。如果您不知道如何在这里为您做一个教程: https:// https:// .makeuseof.com/python-windows-path/

I recommend trying CMD for that, if still not working, try adding your python path to the system variables. If you don't know how to do that here a tutorial for you: https://www.makeuseof.com/python-windows-path/

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文