Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git Bash won't run my python files?

I have been trying to run my python files in Git Bash but I keep getting an error and can't figure out how to fix it. My command as follows in the git bash executable python filename.py then it says

"Bash.exe": python.exe: command not found 

I'm a windows user and I have added the path to my environment variables like so C:\Python27\python.exe;C:\Program Files\Git\bin\bash.exe

I have been looking around but I can't find anyone that has had this problem or they don't give a straightforward answer please help.

Also I have never used Git before this is my first time.

like image 476
user3496571 Avatar asked Apr 04 '14 17:04

user3496571


People also ask

How do I fix Python not running?

Specify the full location to python.exe One way to fix the error would be to launch Python from the Command Prompt by passing in the full path to the executable file each time you wanted to run Python. In other words, instead of typing Python you would type something like C:\Users\me\path\to\python.exe .

Why does py work but not Python?

py is itself located in C:\Windows (which is always part of the PATH ), which is why you find it. When you installed Python, you didn't check the box to add it to your PATH , which is why it isn't there. In general, it's best to use the Windows Python Launcher, py.exe anyway, so this is no big deal.


1 Answers

Adapting the PATH should work. Just tried on my Git bash:

$ python --version sh.exe": python: command not found  $ PATH=$PATH:/c/Python27/  $ python --version Python 2.7.6 

In particular, only provide the directory; don't specify the .exe on the PATH ; and use slashes.

like image 53
gturri Avatar answered Oct 05 '22 20:10

gturri