Using Python with GitBash

Hello all! Hoping someone can help here - I’m attempting to launch a python file through GitBash and it doesn’t want to cooperate. At first, typing “python” would simply remove the entry prompt and nothing would happen. I tried to troubleshoot online, specifying a PATH and alias, but now I receive the below code:

winpty: error: cannot start ‘python.exe’: Not found in PATH

Anyone have any ideas? Git Bash has never been able to work with Python on my computer and it’s starting to be an issue.

did you try python3 at the prompt?

Or, maybe this would help:

or,

I am having the same issue. I am running Windows 10,

  1. I am doing the Off-Platform Project: Coded Correspondence.
  2. I have already completed the course " Learn the Command Line. In result, GitBash has been installed and I was using it to do things non-Python related.
  3. I installed Python 3.11.7 and made sure to “Add Python to PATH”.
  4. I started GitBash and entered python3 as the command and it opens the Microsoft Store to “Get” Python 3.11:
    GitBash Python3

Should I “Get” Python3 through the Microsoft Store? Don’t I already have it since I installed Python3?

No, b/c you already installed it. But, did you add it to your PATH? The error message suggests that they python executable file isn’t in the location it should be. I’m also thinking that the executable file should be python3, right?

What happens when you write (at the command prompt):

which python3

I’m not sure what instructions you followed, but here are some other instructions:

Maybe try here:

And,

and, here:

I did try python3 as well, but it’s saying the command is not found. I removed the PATH that I set up previously, so I’m back to square one, with python3, python, anaconda, and anaconda3 (including capital and lowercase first letters) throwing a “command not found” error.
Adding "winpty " before each throws: “winpty: error: cannot start ‘Python3’: Not found in PATH”
I’ve tried moving python and anaconda files to my home directory, etc, but no luck. Any other ideas?

Try this. Scroll to the answer with 665 votes:

And give this a read:

GOT IT! I ended up uninstalling all python files, then reinstalling using this walkthough article:

There’s an option to create a PATH for python, but it doesn’t come selected - if I don’t manually select it, the computer has been saving it in a random folder that I can’t even access through file explorer. Checking the “create a PATH” option seems to have fixed it! Thanks for all your help!

1 Like

Excellent!
I think that (the automatic PATH placement) was mentioned in one of the links above.

Glad it’s all sorted out now!