4

I've researched this on different places, including stackoverflow, and I can't find an answer that helps me.

I'm using Windows 7, 64 bit, with Atom for 64 bit Windows. I have Python 3.6.1 installed in the directory C:\Users\Austin\Documents\Python. When I try to run a simple script to test Python in Atom, it says

'python' is not recognized as an internal or external command, operable program or batch file. [Finished in 0.083s]

I tried to run the same script in the command line, and it said the same thing. I'm new to programming, so please try to be a little patient.

Dan Lowe
  • 51,713
  • 20
  • 123
  • 112
Austin Butler
  • 69
  • 2
  • 2
  • 10
  • You need to add the Python executable to your environmental variables: http://stackoverflow.com/questions/6318156/adding-python-path-on-windows-7 – HFBrowning Apr 28 '17 at 00:14

7 Answers7

8

Your issue is probably that your Python command is not listed in your PATH environment variable.

Environment Variables are paths, values and other information stored by your operating system and used globally by the OS and different applications you use.

The best example for a command listed in the PATH environment variable is cmd or ping. try to tap Win+R and type cmd, note how it opens a new Command Line even though you don't really know where cmd.exe is stored on your hard drive? That is because the path C:\Windows\System32 is stored in your PATH variable.

So, we know you installed python, but you want to be able to run it without specifying it's path, how can we do that? Simply add it to our environment variables:

  1. Use the keyboard shortcut Win+Pause
  2. Click on Advanced system settings
  3. At the bottom of the window click on Environment Variables...
  4. In the System Variables section find the PATH variable
  5. Double click it
  6. A new window with a text box has opened, go to it's end with the end button
  7. Paste the path C:\Users\Austin\Documents\Python at it's end (be sure to add a ; before pasting if there isn't one there.
  8. Click ok
  9. Open a new cmd window
  10. Try and type python you should be all set now, on the command line and in Atom.

If it isn't clear, the win button is the button on your keyboard with the windows icon on it.

Mor Paz
  • 2,088
  • 2
  • 20
  • 38
  • It still gives me the same error. This is the new directory under my PATH variable - C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Users\Austin\Documents\Python – Austin Butler Apr 28 '17 at 00:46
  • Try to open a new `cmd` and go to the path `C:\U‌​sers\Austin\Document‌​s\Python`, then try typing `./python` does that work? – Mor Paz Apr 28 '17 at 00:51
  • Even with C:\Users\Austin\Documents\Python it still gives me the error that it isn't recongnized. – Austin Butler Apr 28 '17 at 00:56
  • Did typing `./python` work when you went straight to it's path on `cmd`? If not, there might be something wrong with your python installation... – Mor Paz Apr 28 '17 at 00:57
  • Yes. I tried C:\U‌​sers\Austin\Document‌​s\Python and ./python, and both give me the error. Let me reinstall Python... – Austin Butler Apr 28 '17 at 00:59
  • OK, do note that while installing python it offers you to add it to the `PATH` automatically, it's easiest if you tell it to do that, saves you the manual work – Mor Paz Apr 28 '17 at 00:59
  • Okay, I'll try that. – Austin Butler Apr 28 '17 at 01:00
  • Solved! I didn't see that option to add to PATH. Thanks a lot! – Austin Butler Apr 28 '17 at 01:04
  • No problem, if the answer helped you be sure to mark it as the correct one for future readers :) – Mor Paz Apr 28 '17 at 01:05
1

After struggling with same problem: 'python' is not recognized as an internal or external command. I solved it using following way:

  1. In search bar type python, your latest installed python 32-bit app would appear. Select it and right click.

  2. Then select open file location enter image description here

  3. A new page would pop up with auto selected python 32-bit file. Now right click and again select open file location.

enter image description here

  1. Copy the path as I have selected in picture. enter image description here

  2. Now in search bar type Advanced System Setting, and click on it. enter image description here

  3. A new window will pop up. Click on environment variables.

enter image description here

  1. First select Path then Click on edit. enter image description here

  2. Now A new window of edit variable path will open up. In this first click on new >> Add the path of python 32-bit app that we copied >> click on ok.

enter image description here

  1. Now Click OK on environment variables window, Next click OK on system variables window as well. enter image description here

enter image description here

  1. Now python is ready to run in Atom
Captain
  • 91
  • 1
  • 5
1

Adding python to my path, (installed as C:\Program Files\Python39\Python.exe) worked, but only after restarting Atom. Make sure you do that. Looks like it doesn't dynamically watch and reload the path variable from the system ¯\_(ツ)_/¯

0

In very direct terms, it means that there is no executable file named python.exe in any dictionary in your search path (which I think is the PATH environment variable on Windows).

First of all, try executing python from the installation directory. If that works, you know that you have it installed properly, and that the problem is the search path. If that fails, try again with the full path name, such as C:\Users\Austin\Documents\Python\python.exe.

Does that move you closer to a solution?

Prune
  • 76,765
  • 14
  • 60
  • 81
0

Reinstall the latest Python version. One of the first installation screens has a toggle box at the bottom that you can click to add the directory to Path. This worked for me when I ran into the same problem. You have to manually click though and it's easy to ignore it.

  • this has worked for me because when I reinstalled python from scratch and check that checkbox, actually it has added more than one path to environment variables – cozmin-calin Sep 04 '18 at 09:40
0

I solved this issue, by put the good python path in Atom ide-Python simply i put D:\my_python_folder\Python.exe

aymhenry
  • 81
  • 4
0

None of the above answers worked for me. What did work, is installing Python from the Microsoft Store instead of downloading from the web and installing from an installer.