python 无法识别 Windows 10
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/47539201/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
python is not recognized windows 10
提问by Rishabh Mandayam
I recently installed Python 3.6.3 on my device. When I type python in my cmd, it gives me this error. I do have the PATH in the environment variables. Path Lists. This should normally fix it but python is still not recognized. I need help.
我最近在我的设备上安装了 Python 3.6.3。当我在我的 cmd 中输入 python 时,它给了我这个错误。我确实在环境变量中有 PATH。路径列表。这通常应该修复它,但仍然无法识别 python。我需要帮助。
回答by Brian M. Sheldon
Make sure the path is in your System PATH variable and not in a User PATH variable. After adding the path to the PATH variable, make sure you close and re-open any command prompts so they use the updated PATH. You should also confirm the path by checking python directly from the folder. The example below is for the OP's path. Make sure you use the path specific to your installation (e.g. %USERPROFILE%\AppData\Local\Programs\Python\Python36). Also make sure you add a second PATH variable for the Scripts folder (e.g. %USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts) for access to tools such as PIP.
确保路径在您的系统 PATH 变量中,而不是在用户 PATH 变量中。将路径添加到 PATH 变量后,请确保关闭并重新打开所有命令提示符,以便它们使用更新的 PATH。您还应该通过直接从文件夹中检查 python 来确认路径。下面的示例适用于 OP 的路径。确保使用特定于安装的路径(例如 %USERPROFILE%\AppData\Local\Programs\Python\Python36)。还要确保为 Scripts 文件夹(例如 %USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts)添加第二个 PATH 变量,以便访问 PIP 等工具。
cd c:\Python\Python36-32
python --version
回答by fuddin
All the answers on StackOverflow about it were obsolete so decided to add this. The path variable that needs to be added is,
StackOverflow 上关于它的所有答案都已过时,因此决定添加此内容。需要添加的路径变量是,
C:\Users\Username\AppData\Local\Programs\Python\Python36-32
Note that everyone may have a different Username.
请注意,每个人可能有不同的用户名。
回答by maheshmnj
you get this error because the python.exepath has not been added to the System environment variable to do that simply
您收到此错误是因为尚未将python.exe路径添加到系统环境变量中以简单地执行此操作
go to the path
C:\Users\%Username%\AppData\Local\Programs\Python\Python37-32
which contains python.execopy the path and open system environment variables and in the variable section look for variable called Path if not create new variable with Variable Name as Pathand value as the copied path
转到
C:\Users\%Username%\AppData\Local\Programs\Python\Python37-32
包含python.exe的路径复制路径并打开系统环境变量,并在变量部分查找名为 Path 的变量,如果没有创建新变量,变量名作为路径,值作为复制的路径
- once you do that close the window and simply open cmd and type python you should get something like this
- 一旦你关闭窗口并简单地打开 cmd 并输入 python 你应该得到这样的东西
回答by Parth Devloper
**
**
If still not working, as mentioned above in the answers
如果仍然无法正常工作,如上述答案中所述
**
**
then simply move upthe path
然后简单地沿着路径向上移动
as shown in the screenshot
如屏幕截图所示
回答by Nicholas De La Haye
For Python 3.6 there are actually 2 path entries. Also it's best to use the %USERPROFILE% rather then hard coding it.
对于 Python 3.6,实际上有 2 个路径条目。此外,最好使用 %USERPROFILE% 而不是硬编码。
%USERPROFILE%\AppData\Local\Programs\Python\Python36 %USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts
%USERPROFILE%\AppData\Local\Programs\Python\Python36 %USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts
回答by Rahul Sawra
Just Set The Path Variable Correctly As Follows- Go To The Properties Of ThisPc Click Advanced System Settings Click Environment Variables... In System Variables Edit The Path Variable To
只需正确设置路径变量如下 - 转到ThisPc的属性单击高级系统设置单击环境变量...在系统变量中将路径变量编辑为
C:\Users\Username\AppData\Local\Programs\Python\Python36-32
C:\Users\Username\AppData\Local\Programs\Python\Python36-32
Note That, Everyone May have Different UserName.
请注意,每个人可能有不同的用户名。
回答by whitwhoa
I too was struggling with this issue, and everything was configured correctly. I installed and setup my system path variables as one would. And everything was fine. Then upon reboot windows would not recognize 'python' as a command as if it were unaware of the path variable. Double checked to confirm everything was still setup correctly (it was).
我也在为这个问题苦苦挣扎,一切都配置正确。我安装并设置了我的系统路径变量。一切都很好。然后在重新启动时,Windows 不会将“python”识别为命令,就好像它不知道路径变量一样。仔细检查以确认一切仍然正确设置(确实如此)。
It only started to work again after I manually browsed to the directory in which python.exe existed, and ran 'python'. After that windows seemed to recognize my path variable and I could call 'python' from where ever need be. Very odd. Figured I'd share in case someone else runs into this.
在我手动浏览到存在 python.exe 的目录并运行“python”后,它才再次开始工作。在那之后,windows 似乎识别了我的路径变量,我可以从任何需要的地方调用“python”。很奇怪。想我会分享以防其他人遇到这个问题。
回答by Mehran
If you are working with command prompt and if you are facing the issue even after adding python path to system variable PATH.
如果您正在使用命令提示符,并且即使在将 python 路径添加到系统变量 PATH 后仍面临此问题。
Remember to restart the command prompt (cmde.exe).
请记住重新启动命令提示符 (cmde.exe)。