WIN10终端执行python --version提示未识别问题求助
python --version Fails on Windows 10 After Python Installation Hey there! Let's break down the common reasons you're getting the error 'python' is not recognized as an internal or external command, operable program or batch file and what you can do about them:
Python wasn't added to your system PATH during installation
This is the most frequent cause. When installing Python, there's a critical checkbox labeled "Add Python X.X to PATH" (where X.X is your version number) near the bottom of the installer window. If you skipped checking this, your Windows system doesn't know where to find thepythonexecutable.
To fix this: You can either re-run the Python installer and make sure to tick that PATH checkbox, or manually add the Python installation directory (usuallyC:\Users\<YourUsername>\AppData\Local\Programs\Python\PythonXX) and itsScriptssubfolder to your system's Environment Variables > System Variables > PATH. Don't forget to restart your terminal after making changes.You need to use
python3instead ofpython
Some newer Python 3 installations on Windows map the executable topython3.exeinstead ofpython.exe. Try runningpython3 --versionin your terminal—this might work if the standardpythoncommand doesn't.Your terminal was opened before installing Python
Terminal windows load environment variables when they first launch. If you had a terminal open before installing Python, it won't pick up the new PATH entries added by the installer. Simply close your current terminal window, open a new one, and try thepython --versioncommand again.Corrupted or mislocated Python installation
In rare cases, the installation might have failed silently, leaving missing or corrupted files, or Python might have been installed in an unexpected directory. Check if the Python installation folder exists (use the default path mentioned earlier) and containspython.exe. If something looks off, uninstall Python, download the official installer, and reinstall it carefully.
内容的提问来源于stack exchange,提问作者Ochitsuku

