I know this question has been asked before but I can't find a solution that will work for me. I have uninstalled and reinstalled python serval times and changed the path location. Whenever I run python in cmd I get this error 'python' is not recognized as an internal or external command, operable program or batch file. Python will work in my Jupyter Notebook, but if I need to pip install something I am unable to do so.
1 Answers
Whenever I run
pythonincmdI get this error'python' is not recognized as an internal or external command, operable program or batch file.
You need to add python.exe to your Windows path variable(s). You can do this when installing Python with the official installer from python.org by selecting a custom installation and marking the correct option to add Python to your environment variables.
If you need to add the path to Python to your Windows path variable(s) manually (ex. because Python is already installed), look for the Windows Search and type env into it. Click the first link indicating you wish to edit your environment variables.
If you are on Windows 7, add e.g.
;C:\path\to\pythonto the end of yourPathvariable underSystem variables, wherepythonis your Python installation folder (only usePATHunder your user variables if you want Python to be accessible by that user alone). If you click the wrong link in Windows Search, you may need to click theEnvironment Variables...button to get to the settings described.On Windows 10, just add
C:\path\to\pythonto the end of the list (in a new field).Do not add
python.exeto your path entry (i.e.C:\path\to\python\python.exeis wrong).
Python will work in my Jupyter Notebook, but if I need to
pipinstall something I am unable to do so.
Adding Python to you environment variables through the official installer (above) should solve this. If not, you will need to perform the same (rough) steps above but add C:\path\to\python\Scripts to your path (Scripts is the folder where pip.exe lives).
In either case, reboot your PC before attempting to access python/pip from the command line.
- 18,227
