问题
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.
回答1:
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.
cd c:\Python\Python36-32
python --version
回答2:
All the answers on StackOverflow about it were obsolete so decided to add this. The path variable that needs to be added is,
C:\Users\Username\AppData\Local\Programs\Python\Python36-32
Note that everyone may have a different Username.
回答3:
you get this error because the python.exe path has not been added to the System environment variable to do that simply
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 Path and value as the copied path
- once you do that close the window and simply open cmd and type python you should get something like this
回答4:
For Python 3.6 there are actually 2 path entries. Also it's best to use the %USERPROFILE% rather then hard coding it.
%USERPROFILE%\AppData\Local\Programs\Python\Python36 %USERPROFILE%\AppData\Local\Programs\Python\Python36\Scripts
回答5:
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
C:\Users\Username\AppData\Local\Programs\Python\Python36-32
Note That, Everyone May have Different UserName.
回答6:
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).
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.
来源:https://stackoverflow.com/questions/47539201/python-is-not-recognized-windows-10