簡體   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