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