[英]After adding Python to my windows PATH Powershell stopped recognizing simple commands like cmd and help. Does anyone know how to fix this?
I added Python to my Windows path so that I could use the pip and pyinstaller commands, now commands like cmd, py, and even the 'help' command aren't recognized by Powershell.我将 Python 添加到我的 Windows 路径中,以便我可以使用 pip 和 pyinstaller 命令,现在 Powershell 无法识别诸如 cmd、py 甚至“help”命令之类的命令。 Trying to use these commands results in the "cmd : The term 'cmd' is not recognized as the name of a cmdlet, function, script file, or operable program."
尝试使用这些命令会导致“cmd : 术语 'cmd' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。” error.
错误。 I am an amateur developer and I am still very new to programming and file management, I don't know what caused this but I suspect it may have to do with adding Python to the windows PATH.
我是一名业余开发人员,我对编程和文件管理仍然很陌生,我不知道是什么原因造成的,但我怀疑这可能与将 Python 添加到 Windows PATH 有关。 I've looked all over the internet and tried everything I found, nothing seems to work.
我查看了整个互联网并尝试了我发现的所有内容,似乎没有任何效果。 As I have already said, I am very new to all of this and I am almost certain that I am omitting at least some relevant information but I don't know what else you might need to help me, so I am happy to provide any additional information as needed.
正如我已经说过的,我对这一切都很陌生,我几乎可以肯定我至少省略了一些相关信息,但我不知道您还需要什么来帮助我,所以我很乐意提供任何根据需要提供其他信息。
ex.前任。 When trying the 'help' command in Powershell, Powershell seems to recognize it as 'more.com', so it would seem that Powershell recognizes the 'help' alias but doesn't know what it's supposed to do.
在 Powershell 中尝试 'help' 命令时,Powershell 似乎将其识别为 'more.com',因此 Powershell 似乎识别了 'help' 别名,但不知道它应该做什么。
PS C:\Users\julien> help
more.com : The term 'more.com' 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:9 char:19
+ } else { $input | more.com }
+ ~~~~~~~~
+ CategoryInfo : ObjectNotFound: (more.com:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
edit: As per the advice of JosefZ I ran the echo [%path:;=]&echo.[%]
command in PS, I don't how to interpret this, but this is what it gave me:编辑:根据 JosefZ 的建议,我在 PS 中运行了
echo [%path:;=]&echo.[%]
命令,我不知道如何解释这一点,但这就是它给我的:
[C:\Users\julie\AppData\Local\Programs\Python\Python39]
[C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts]
[C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts\]
[C:\Users\julie\AppData\Local\Programs\Python\Python39\]
[]
To address Lee_Dailey I ran your $env:Path -split ';'
为了解决 Lee_Dailey 我跑了你的
$env:Path -split ';'
command as well and was given an identical output, just to make sure i'm not missing something important though, here are the results:命令也得到了相同的输出,只是为了确保我没有遗漏一些重要的东西,以下是结果:
C:\Users\julie\AppData\Local\Programs\Python\Python39
C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts
C:\Users\julie\AppData\Local\Programs\Python\Python39\Scripts\
C:\Users\julie\AppData\Local\Programs\Python\Python39\
Like I said, I don't really know how to interpret any of this, hopefully someone smarter than me can translate this to me and explain how to fix whatever I broke.就像我说的,我真的不知道如何解释这些,希望比我更聪明的人可以把它翻译给我,并解释如何修复我破坏的任何东西。 Thanks for the help!
谢谢您的帮助!
you replaced your path instead of adding to it .你替换了你的路径而不是添加到它。 [ grin ]
[咧嘴笑]
here is my path list.这是我的路径列表。 you can use it to rebuild yours ...
你可以用它来重建你的......
C:\Python39\Scripts\
C:\Python39\
C:\WINDOWS\system32
C:\WINDOWS
C:\WINDOWS\System32\Wbem
C:\WINDOWS\System32\WindowsPowerShell\v1.0\
C:\WINDOWS\System32\OpenSSH\
C:\Program Files\Microsoft VS Code\bin
C:\Program Files\Calibre2\
C:\Program Files\Prio
C:\ProgramData\chocolatey\bin
C:\Program Files\PowerShell\7\
C:\Program Files\Git\cmd
C:\Users\MyUserName\AppData\Local\Microsoft\WindowsApps
just remember to leave off things that are not on your setup.只要记住不要设置不在您的设置中的东西。 i suspect you won't have
Prio
or Calibre
.我怀疑你不会有
Prio
或Calibre
。 [ grin ] [咧嘴笑]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.