Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/powershell/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
“命令”;其中python“;在PowerShell中不返回任何内容_Python_Powershell - Fatal编程技术网

“命令”;其中python“;在PowerShell中不返回任何内容

“命令”;其中python“;在PowerShell中不返回任何内容,python,powershell,Python,Powershell,正如标题所暗示的,当我试图从PowerShellwhere python返回任何内容时。没有错误什么的。。。它只是转到一个新行(好像我按了“回车键”) 另一方面,CMD提示符成功返回以下内容: C:\Users\User>where python C:\Users\User\AppData\Local\Programs\Python\Python38\python.exe C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.ex

正如标题所暗示的,当我试图从PowerShell
where python
返回任何内容时。没有错误什么的。。。它只是转到一个新行(好像我按了“回车键”)

另一方面,CMD提示符成功返回以下内容:

C:\Users\User>where python
C:\Users\User\AppData\Local\Programs\Python\Python38\python.exe
C:\Users\user\AppData\Local\Microsoft\WindowsApps\python.exe

python--version
成功返回中的版本,包括pwsh和cmd。有人能想出如何修复powershell中的
where
吗?

在powershell中,
where
where Object
cmdlet的别名

要显式调用
where.exe
,请包括
.exe
扩展名:

PS ~> where.exe python
C:\Users\mathias\AppData\Local\Microsoft\WindowsApps\python.exe

如果要找出某个命令名无法按预期解析的原因,请使用:


作为一个有趣的奖励,你新发现的
Get命令
知识可能被证明
where.exe
过时了,因为
Get命令
显然也有能力定位可执行文件:)

PS ~> Get-Command where

CommandType     Name                                               Version    Source
-----------     ----                                               -------    ------
Alias           where -> Where-Object


PS ~> Get-Command where*

CommandType Name                  Version      Source
----------- ----                  -------      ------
Alias       where -> Where-Object
Cmdlet      Where-Object          3.0.0.0      Microsoft.PowerShell.Core
Application where.exe             10.0.19041.1 C:\WINDOWS\system32\where.exe
PS ~> Get-Command python
    
CommandType Name       Version Source
----------- ----       ------- ------
Application python.exe 0.0.0.0 C:\Users\mail\AppData\Local\Microsoft\WindowsApps\python.exe