-->

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

2020-08-09 06:50发布

问题:

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?

回答1:

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


回答2:

Hmmm. If you're using Python 2.7 like the instructions say to, you could try instead of that doing "C:/Python27/python.exe" insted of "python".



回答3:

I think you can add the location of the python.exe in the PATH environment variable. Follow the steps: Go to My Computer->Right click->Properties->Advanced System Settings->Click Environmental Variables. Now click PATH and then click EDIT. In the variable value field, go to the end and append ';' (without quotes) and then add the absolute path of the .exe file which you want to run via Git-Bash.



回答4:

don't know if this could be your issue, but its always worth a check. check your python path is set correctly? computer->properties->advanced system settings-> environment variables->system variables->PYTHONPATH, value = C:\PYTHON20;C:\PYTHON20\DLLS;C:\PYTHON20\LIB;C:\PY THON20\LIB\LIB-TK