I have python 3.6 installed on my Win7 system and am trying to get it working in the git bash (MINGW64), so far to no avail.
I've added the install directory (NOT the .exe, of course) to PATH, with no results.
Even if I directly cd
to the install directory, it doesn't see it.
$ python
bash: python: command not found
$ echo $PATH
/c/Users/Aerovistae/bin:/mingw64/bin:/usr/local/bin:/usr/bin:/bin:/mingw64/bin:/usr/bin:/c/Users/Aerovistae/bin:/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon:/cmd:/c/Program Files (x86)/Skype/Phone:/c/Program Files/Intel/WiFi/bin:/c/Program Files/Common Files/Intel/WirelessCommon: C:/Users/Aerovistae/AppData/Local/Programs/Python/Python36-32:/usr/bin/vendor_perl:/usr/bin/core_perl
$ cd C:/Users/Aerovistae/AppData/Local/Programs/Python/Python36-32
$ python
bash: python: command not found
$ python.exe
bash: python.exe: command not found
If I try ./python
from inside that directory, it just goes to the next line when I hit enter, and allows me to keep typing because it's expecting more to the command for some reason. ./python
isn't being recognized as a complete command, and it is waiting for closure, as if I had an open-quote but no close-quote. Can't figure out why.
What am I missing here? Why can't it run the .exe even when I'm in the directory?
Sidenote, why does it show PATH
as having colon separators rather than semi-colon separators?
why does it show PATH as having colon separators rather than semi-colon separators?
Because bash uses :
as a path separator. This means that C:/yadda/yadda
in your PATH environment variable is parsed as two directories: C
and /yadda/yadda
. If you look closely at your echo $PATH
output you will see that many entries start with /c/
. The entry for your python installation is the only one which uses C:/
. You should use the /c/
notation when setting PATH in .bashrc or .profile.
Also be careful about spaces in path names and extraneous spaces before and after :
. The former is definitely problematic. I am not certain about the latter since I never add spaces in this location when setting PATH.
If I try ./python from inside that directory, it just goes to the next line when I hit enter, and allows me to keep typing because it's expecting more to the command for some reason.
Per the comment from @eryksun:
You either need to run bash.exe in a normal Windows console or, if using the mintty terminal, force Python to use interactive mode via python -i
. mintty hides the real console and sets StandardInput
to a pipe named \\.\pipe\msys-[UNIQUE_ID]-pty0-from-master
and StandardOutput
to a pipe named \\.\pipe\msys-[UNIQUE_ID]-pty0-to-master
. A pipe is not a character device in Windows, so isatty
returns false, so Python starts in non-interactive mode unless forced otherwise via the -i
option.
try using this command on your git bash: alias python='winpty python.exe
If you can use Python normally and you can output and input without problems you can add that command in your .bashrc configuration file (usually in the same directory of your .git and .mintty configuration files (under your username on Windows).
I don't know what winpty actually does but I guess it's what it's described here: https://github.com/rprichard/winpty
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