簡體   English   中英

即使將 Python 和 Powershell 添加到路徑后也會出現問題

[英]Python and Powershell issue even after adding it to path

當我嘗試在 Powershell 中運行 python 命令時,出現此錯誤

Program 'python' failed to run: No application is associated with the specified file for this

我在C:\Users\hp\AppData\Local\Programs\Python\Python35目錄中安裝了 python。 我嘗試在系統環境變量路徑中添加它並重新啟動 Powershell 但得到相同的錯誤。 也嘗試通過其他答案中給出的命令進行操作,但它不起作用

  1. 確保您可以通過在 powershell 中鍵入C:\Users\hp\AppData\Local\Programs\Python\Python35\python.exe來啟動 python。

  2. 確保C:\Users\hp\AppData\Local\Programs\Python\Python35已添加到 PATH。

  3. 重新啟動系統。

如果這是針對 windows 的,那么您不必明確提及路徑,因為只需單擊“添加到路徑”即可。

很可能您在安裝過程中設置時沒有給出確切的路徑,即 C:\Users\hp\AppData\Local\Programs\Python\Python35。

當您在執行腳本時給出確切路徑時,Python 是否會運行? 如果沒有其他工作,請嘗試重新啟動系統或重新安裝 Python 並確保選中“添加到路徑”框。

您可能需要重新啟動計算機才能使新路徑生效,僅重新啟動 powershell 將不起作用。

Go 設置,應用程序,應用程序執行別名,然后關閉 python.exe 和 python3.exe 的應用程序安裝程序選項。 之后,您安裝的 python 的路徑應該可以正常工作。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM