Search code examples
pythonwindowsfreezegit-bash

How to use python on gitbash


Python will not run in git bash (Windows). When I type python in the command line, it takes me to a blank line without saying that it has entered python 3.9.1 like it does in Powershell. It doesn't give me an error message, but python just doesn't run.

This is what happens when I type python. It just freezes. Any Idea on how to fix it. I cannot use command prompt because it causes some error when I import a module it says ModuleNotFound.

Selvi@DESKTOP-H75HFL5 MINGW64 /
$ python

2*2

Solution

  • Getting python run in git bash you simply can type winpty python or you can use python -i

    Note: if you use winpty python you can exit python with CTRL + Z or exit(), but if you used python -i, you only can exit with exit().