简体   繁体   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?

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 .我怀疑你不会有PrioCalibre [ grin ] [咧嘴笑]

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

相关问题 有谁知道在我的 python 程序中在哪里修复此错误? - Does anyone know where to fix this error in my python program? python 即使添加到 PATH 后也无法在 Windows CMD 中识别 - python not recognized in Windows CMD even after adding to PATH 有谁知道如何在 Windows 上安装 Python P5 Package? - Does anyone know how to install the Python P5 Package on Windows? 为什么我的 python 没有显示在 cmd 中,尽管我添加了系统变量的路径? - Why does my python not show in cmd despite me adding the path to my system variables? 即使将 Python 和 Powershell 添加到路径后也会出现问题 - Python and Powershell issue even after adding it to path 有谁知道如何修复“sqlalchemy.exc.AmbiguousForeignKeysError”? - Does anyone know how to fix “sqlalchemy.exc.AmbiguousForeignKeysError”? 有谁知道如何解决这个 discord.py 错误 - does anyone know how to fix this discord.py error 有谁知道如何从此代码中获取文件保存路径? - Does anyone know how to get the file save path from this code? Spotify:有人知道 Windows 10 Spotify 桌面应用程序的任何命令提示符命令吗? - Spotify: Does anyone know any command prompt commands for the Windows 10 Spotify desktop app? 将Django CMS添加到我的项目后,管理命令失败,并显示缓存错误。 我该如何解决? - After adding Django CMS to my project, management commands fail with a cache error. How can I fix it?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM