Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

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?

like image 281
Matt Avatar asked Oct 26 '12 17:10

Matt


People also ask

Does git bash have Python?

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 2.7. 10 like its does in Powershell.


1 Answers

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 
like image 157
Anonymous Coward Avatar answered Sep 25 '22 19:09

Anonymous Coward