简体   繁体   English

/ bin / env:python:没有这样的文件或目录(Windows通过Git Bash尝试安装新的Parse Cloud Code)

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

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. 试图从这里链接安装python似乎不能访问Msysgit中的python命令...按照这里的说明 ,实际上并没有说如何让python按需工作。

Current error when running parse new project_name is: 运行parse new project_name时的当前错误是:

/bin/env: python: No such file or directory / bin / env:python:没有这样的文件或目录

I believe it's likely because it installed it at C:\\Python ... anyone know how to fix this? 我相信它可能是因为它安装在C:\\Python ...有谁知道如何解决这个问题?

This error means that Git Bash does not know where your python.exe is. 此错误意味着Git Bash不知道您的python.exe在哪里。 It searches your normal windows search path, the PATH environment variable. 它搜索正常的Windows搜索路径,即PATH环境变量。 You're probably failing the 4th step on the instructions already "Make sure Python is working in the Git Bash": 你可能已经失败了说明的第4步“确保Python在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) . 要解决此问题,请将C:\\Python (或安装python的任何地方)附加到Windows中的PATH环境变量(此处的说明) You need to restart the bash after this for the change to take effect. 您需要在此之后重新启动bash才能使更改生效。 This will allow you to run python from the windows command prompt as well. 这将允许您从Windows命令提示符运行python。

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: 如果您不想更改Windows PATH变量或使python仅对git bash可用,则可以在%USERPROFILE%目录中创建.bashrc文件并在其中设置变量:

C:\>notepad %USERPROFILE%\.bashrc

and add 并添加

export PATH=/c/Python:$PATH 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. 每次启动git bash时都会执行该脚本,并将C:\\Python前置为git bash的PATH变量,保持系统范围的PATH变量不变。

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) 既然你知道要做什么,你可以在bash上使用这个快捷方式(将导出命令附加到你的.bashrc)

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

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". 如果您按照说明使用Python 2.7,则可以尝试使用“C:/Python27/python.exe”进行“python”。

I think you can add the location of the python.exe in the PATH environment variable. 我想你可以在PATH环境变量中添加python.exe的位置。 Follow the steps: Go to My Computer->Right click->Properties->Advanced System Settings->Click Environmental Variables. 按照以下步骤操作:转到我的电脑 - >右键单击 - >属性 - >高级系统设置 - >单击环境变量。 Now click PATH and then click EDIT. 现在单击PATH,然后单击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. (不带引号)然后添加要通过Git-Bash运行的.exe文件的绝对路径。

don't know if this could be your issue, but its always worth a check. 不知道这可能是你的问题,但总是值得一试。 check your python path is set correctly? 检查你的python路径设置是否正确? 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 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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM