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.
-
4I think this is what you want: https://superuser.com/questions/143119/how-do-i-add-python-to-the-windows-path?rq=1 – rm-vanda Nov 05 '19 at 21:50
-
Python.exe is not in your path – Mawg says reinstate Monica Nov 07 '19 at 08:05
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.
- 16,718
- 4
- 38
- 45
-
1Windows applies PATH additions automatically, on the fly, if added via the GUI, as soon as the Advanced Properties window is closed via OK and the terminal restarted – JW0914 Nov 06 '19 at 11:16
-
I have run into the issue (on Windows 7) where I have added something to the System `Path` and it will (apparently) be immediately available in some instances but not in others. Example: using `Shift + Right-Click` and `Open command window here` will allow an item added to the System `Path` variable to be immediately used. However, using the same steps from an `Explorer` (file) window will yield `'new_program' is not recognized as an internal or external command, operable program or batch file.` – Anaksunaman Nov 06 '19 at 11:34
-
In case it helps, I use [ConEmu](https://conemu.github.io/) and an updated PATH will not apply until all instances of ConEmu have been closed and ConEmu restarted. I'm not sure how the native PowerShell and command terminals deal with PATH changes, but it may be in a similar way – JW0914 Nov 06 '19 at 11:46
