cmd 错误,因为 python 版本未显示

Error in cmd as python version not showing

我在写

python --version

我在命令提示符下什么也没得到。我应该得到 python 的版本详细信息,对吗?如何纠正?

pip 也一样,要下载哪个文件以及如何安装它们,.whl 还是.grz?该指南显示了使用 pip --version 的方法,该方法首先在 cmd 中不起作用。

你没说你的问题是怎么解决的,我得自己想办法了。 我的问题是 WindowsApps 文件夹中的 0kb Python.exe,它位于 PATH 环境变量中。我刚刚删除了那个文件,一切正常。

有同样的问题。我通过将 python.exe 目录添加到环境变量

来解决问题
Open System Properties (Right click Computer in the start menu, or use the keyboard shortcut Win+Pause)
Click Advanced system settings in the sidebar.
Click Environment Variables...
Select PATH in the System variables section
Click Edit

Add Python's path to the end of the list (the paths are separated by semicolons). For example:

C:\Windows;C:\Windows\System32;C:\Python27

我发现在终端中输入 python --version 也不起作用,但输入 py --version 可以。