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.
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 .
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With