How to use python on gitbash

Question:

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

Answers:

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().

Answered By: brutus314

Actually I was having the same problem. The only thing is that when you enter the Python command prompt with python -i, you can only exit it with quit()

Categories: questions Tags: , , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.