GAE Go Windows – “无法运行程序”,”不是有效的 Win32 应用程序”

huangapple go评论102阅读模式
英文:

GAE Go Windows - "Cannot run program", "is not a valid Win32 application"

问题

我一直在尝试在我的Windows机器上使用GoClipse运行我在Mac上开发的GAE Go项目,安装和配置了适当的SDK等。当尝试运行项目时,我遇到了这个错误:

> 执行命令行时发生异常。无法运行程序
> "C:\GoogleAppEngine\dev_appserver.py"(在目录
> "D:\Golang\workspace\Project\src\pkg"):CreateProcess
> 错误=193,%1 不是有效的Win32应用程序

如何修复这个错误以便运行我的项目?

英文:

I've been trying to run a GAE Go project I developed on my Mac on my Windows machine with GoClipse after installing and configuring the appropriate SDKs and so forth. When attempting to run the project, I get this error:

> Exception occurred executing command line. Cannot run program
> "C:\GoogleAppEngine\dev_appserver.py" (in directory
> "D:\Golang\workspace\Project\src\pkg"): CreateProcess
> error=193, %1 is not a valid Win32 application

How can I fix that error in order to run my project?

答案1

得分: 1

在Mac上,下面的配置可以工作,因为它默认安装了Python,但是在Windows上需要进行不同的配置。

在Mac上,GoClipse的外部工具配置应该是:

位置:/GoogleAppEngine/dev_appserver.py
工作目录:${workspace_loc:/Project/src/pkg}
参数:.

Windows的配置应该是:

位置:C:\Python27\Python.exe
工作目录:
参数:C:\GoogleAppEngine\dev_appserver.py "${workspace_loc:/Project/src/pkg}"
英文:

While the below configuration works on the Mac as it has Python installed by default, Windows requires a different configuration.

On Mac the GoClipse External Tools Configuration would be:

Location: /GoogleAppEngine/dev_appserver.py
Working Directory: ${workspace_loc:/Project/src/pkg}
Arguments: .

The Windows configuration should look like:

Location: C:\Python27\Python.exe
Working Directory:
Arguments: C:\GoogleAppEngine\dev_appserver.py "${workspace_loc:/Project/src/pkg}"

答案2

得分: 0

尝试在Windows上直接运行.py文件(我认为是Python文件)是行不通的。您需要安装Python,然后将上述文件名传递给Python,类似于(我不懂Python,所以不要按照精确的语法,您可能需要查找):

python "C:\GoogleAppEngine\dev_appserver.py

之所以在Mac上可以工作,是因为Python已经预装在Mac上,如这里所述。但在Windows上没有预装。因此,您可以安装Python并将Python的bin文件夹添加到路径中,然后运行上述脚本,它应该可以正常运行!

英文:

Trying to run .py (Which IMO is a Python file?) wont work directly on windows. You will need to install Python and then pass the above filename to Python something like (I don't know Python so don't go by exact syntax, you might need to look around)

python "C:\GoogleAppEngine\dev_appserver.py

The reason it's working on Mac is because Python comes pre-installed on mac as cited here But on windows it doesn't. So you can install Python and add the Python's bin folder to path, and then run above script and it should run fine!

huangapple
  • 本文由 发表于 2012年7月3日 10:20:43
  • 转载请务必保留本文链接:https://go.coder-hub.com/11303670.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定