pythonwindowsgitbash

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.


Solution

  • 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.