繁体   English   中英

将 Python 添加到我的 Windows PATH Powershell 后,它停止识别诸如 cmd 和 help 之类的简单命令。 有谁知道如何解决这一问题?

[英]After adding Python to my windows PATH Powershell stopped recognizing simple commands like cmd and help. Does anyone know how to fix this?

我将 Python 添加到我的 Windows 路径中,以便我可以使用 pip 和 pyinstaller 命令,现在 Powershell 无法识别诸如 cmd、py 甚至“help”命令之类的命令。 尝试使用这些命令会导致“cmd : 术语 'cmd' 未被识别为 cmdlet、函数、脚本文件或可运行程序的名称。” 错误。 我是一名业余开发人员,我对编程和文件管理仍然很陌生,我不知道是什么原因造成的,但我怀疑这可能与将 Python 添加到 Windows PATH 有关。 我查看了整个互联网并尝试了我发现的所有内容,似乎没有任何效果。 正如我已经说过的,我对这一切都很陌生,我几乎可以肯定我至少省略了一些相关信息,但我不知道您还需要什么来帮助我,所以我很乐意提供任何根据需要提供其他信息。

前任。 在 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

编辑:根据 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\]
[]

为了解决 Lee_Dailey 我跑了你的$env:Path -split ';' 命令也得到了相同的输出,只是为了确保我没有遗漏一些重要的东西,以下是结果:

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\

就像我说的,我真的不知道如何解释这些,希望比我更聪明的人可以把它翻译给我,并解释如何修复我破坏的任何东西。 谢谢您的帮助!

替换了你的路径而不是添加到它 [咧嘴笑]

这是我的路径列表。 你可以用它来重建你的......

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  

只要记住不要设置不在您的设置中的东西。 我怀疑你不会有PrioCalibre [咧嘴笑]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM