【问题标题】:Commands don't work in vscode powershell terminal命令在 vscode powershell 终端中不起作用
【发布时间】:2019-12-25 02:14:23
【问题描述】:

当我尝试在 vscode 的终端中执行任何命令时,我收到了类似的错误。有谁知道如何解决这个问题?

pip : The term 'pip' 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
+ pip install nba_api
+ ~~~
    + CategoryInfo          : ObjectNotFound: (pip:String) [], CommandNotF  
   oundException
    + FullyQualifiedErrorId : CommandNotFoundException

【问题讨论】:

  • 这通常是您的系统PATH 的问题。试试this answer

标签: python-3.x powershell visual-studio-code


【解决方案1】:

您必须将 pip 的路径包含到您的 PATH 环境变量中。 Powershell 或 Cmd 无法自动理解路径。如果不在 PATH 环境变量中登记目录,则必须包含 pip 命令的完整路径。所以你必须使用这个:

cmd /c "setx.exe PATH %PATH%;ThePathOfPip"

运行此关闭所有 powershell 实例后,更改将在下一次会话后显着。

这也可以:

$env:path = $env:path + ";" + "The path of pip"

但它只会保存当前会话的值,所以我不推荐它。

使用评论提供的链接并结合我自己的知识编写了这个答案。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-10-17
    • 1970-01-01
    • 2021-06-06
    • 2015-03-14
    • 2018-09-01
    • 2014-05-23
    • 1970-01-01
    相关资源
    最近更新 更多