6

I'm not a great coder, in fact I'm just trying to learn, but I can't get Geany to regonise Python in my system (Windows 7) when I try to execute the program. When I click Execute, it opens a command prompt saying:

'python' is not recognized as an internal or external command, operable program or batch file

How can I fix this?

Ry-
  • 218,210
  • 55
  • 464
  • 476
user1518770
  • 61
  • 1
  • 1
  • 3

4 Answers4

14

Add the Python executable to your PATH. For example, I have Python installed at:

C:\Program Files\Python 3.2

So press Win + Pause/Break, and go to "Advanced System Settings":

System settings

Click "Environment Variables" at the bottom, add a new user variable called PYTHONDIR, and set it to your Python installation directory:

Adding a new environment variable

Then, look for another variable there called PATH. If there isn't one, create one and give it the value %PYTHONDIR%; otherwise, append ;%PYTHONDIR to the existing one. It should work fine now.

Adding the PYTHONDIR to the PATH variable

Ry-
  • 218,210
  • 55
  • 464
  • 476
4

Or you can skip the New User Variable. Find the PATH variable and click Edit. You want to add ;C:\Python27 to the end of that string. Save your change.

via: http://pythoncentral.org/how-to-install-python-2-7-on-windows-7-python-is-not-recognized-as-an-internal-or-external-command/

noonan
  • 37
  • 3
2

I had the same problem and found that setting the path as described in the other prior posts was necessary but not sufficient. In my case, I had saved my script to the "geany" directory. It turns out that there was a permissions problem with the geany editor trying to create a temporary file in the geany folder. As soon as I saved my script to another folder the permissions error went away.

James Page
  • 21
  • 1
0

I faced this issue. Added python to PATH, working fine on cmd. But Geany wasn't able to execute. Turns out, while saving the file, I had not entered .py as extension. Once I did it, worked fine.

SanSolo
  • 2,267
  • 2
  • 24
  • 32