/bin/env: python: No such file or directory (Windows through Git Bash trying to install new Parse Cloud Code)

Matt picture Matt · Oct 26, 2012 · Viewed 32.9k times · Source

Trying to install python from the link here does not seem to give access to the python command in Msysgit... following the instructions here, does not actually say how to get python to work as needed.

Current error when running parse new project_name is:

/bin/env: python: No such file or directory

I believe it's likely because it installed it at C:\Python... anyone know how to fix this?

Answer

Anonymous Coward picture Anonymous Coward · Oct 29, 2012

This error means that Git Bash does not know where your python.exe is. It searches your normal windows search path, the PATH environment variable. You're probably failing the 4th step on the instructions already "Make sure Python is working in the Git Bash":

$ python --version
sh.exe: python: command not found

To fix that, append C:\Python (or wherever you installed python) to your PATH environment variable in windows (instructions here). You need to restart the bash after this for the change to take effect. This will allow you to run python from the windows command prompt as well.

C:\> python --version
Python 2.7.2

If you don't want to alter your windows PATH variable or make python only available to git bash, you could create a .bashrc file in your %USERPROFILE% directory and set the variable there:

C:\>notepad %USERPROFILE%\.bashrc

and add

export PATH=/c/Python:$PATH

to the file. That script is executed every time you start the git bash and prepends C:\Python to git bash's PATH variable, leaving the system-wide PATH variable untouched.

Now that you know what has to be done, you can use this shortcut on the bash instead (appends the export command to your .bashrc)

$ echo export PATH=/c/Python:\$PATH >> ~/.bashrc