“命令”;其中python“;在PowerShell中不返回任何内容
正如标题所暗示的,当我试图从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
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