Basically, I type python
into Git Bash command line and I get back a blank line as if the command line is thinking...
I've done plenty of research but I can't seem to run python on Git Bash by typing in python into the command line.
I was looking at the question: Python not working in the command line of git bash and someone recommended to type:
winpty c:/Python34/python.exe
into the command line and it worked! However, I don't want to have to keep typing that entire command into the command line.
Solution: At the command prompt, paste this command export PATH="$PATH:/c/Python36" . That will tell Windows where to find Python.
"One caveat if using Git Bash with MinTTY: python doesn't go into interactive mode so a solution is to force it to start that way: echo alias python=\"python -i\" >> ~/.bash_profile"]
For more details
I had the same issue and using "python -i" solved it.
A few of the solutions here should help you out.
Or, as @adarsh suggests, add the following to ~/.bashrc (or in ~/.bash_profile if this doesn't work for your version of Git Bash):
PATH=$PATH:c/Python34/
The comment of adding it to the .bashrc is likely the best answer.
Type:
Now type python3 in gitbash hit enter and there you go!
If you have two version of Python installed I would just point exe independently. example:
$ '/d/Python 3.6.4/python.exe' /d/1.APPS/gitHUBprojects/project1/project1.py
@Mindputty's answer above worked best for me -- in .bash_profile
-- with the addition of the -i
option:
alias py="winpty C:/Python38/python.exe -i"
Also added:
alias py="winpty C:/Python38/python.exe -i"
I'm on Windows 10 (64-bit) with git-for-windows 2.25.windows.1 and python 3.8.2.
(@Mindputty - sorry, don't have enough cred to upvote. But thank you--this was driving me crazy.)
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