On git bash
, I receive a command not found
message for python
, r
and nano
.
I am on Windows 10. I do
Start from the basics. Try the simplest thing that can possibly work, and make progress in baby steps, from one sane state to the next.
The first step is to run a by entering its absolute path directly.
If the Python executable is at /c/Python36/python.exe
, then run this:
/c/Python36/python.exe --version
This is very simple and it should just work. If it doesn't, the command will give you an error message with clues.
A next step could be to simulate adding to PATH
. Try this:
PATH="/c/Python36:$PATH" python.exe --version
This is one line. It sets a value to PATH
in a way such that it's only active during the execution of the command. After the command completes, the value of PATH
will be back to what it was before. This is a good way to test things. Also notice that I prepended to PATH
the directory that contains python.exe
, not the full path to python.exe
.
That's an important point, this is how the PATH
variable works.
It's a list of directories, and all executable files in those directories become easily executable by simply typing their name, without having to type their absolute paths.
Next, I would try this:
PATH="/c/Python36:$PATH" python --version
That is, see if you can drop the .exe
from the name of the command.
I don't have Windows so I cannot test if this works.
And maybe it doesn't. (But I think it does.)
If everything worked so far, then the next step is to make the PATH
setting permanent.
The way to do that is to put the command PATH="/c/Python36:$PATH"
into a file that is always executed when you start a new Git Bash session.
If I remember correctly on Windows you can put it in ~/.profile
(a file named .profile
in your home directory).
Where is ~
? Here's one way to find it:
cd
explorer .
The above opens a file manager inside that directory.
You can use a plain-text editor like Notepad or Wordpad to edit it.
You can also use this shell command to append the line that updates PATH
:
echo 'PATH="/c/Python36:$PATH"' >> ~/.profile
This line will get executed in all new Git Bash session. Not in the current session, because this file is only executed once.
If everything above worked, then in a new Git Bash session you should be able to run python --version
.
If not everything worked, then you need to read the error message you get carefully, and not advance to the next step until the problem is resolved.
It's useless to advance to a next step when you are already not in a sane state.
You can follow the exact same logical process for all the other programs too.