doy57007 2016-02-25 06:02
浏览 151
已采纳

收到错误“名称'execfile'未定义”

enter image description here

I have followed all the steps on https://cloud.google.com/appengine/docs/go/#creating_a_simple_http_handler on how to get started with Go, but I am stuck on an issue while trying to run the helloworld app.

I get the following error:

C:\Users\kirill\Desktop\go_appengine>goapp serve myapp

Traceback (most recent call last):
  File "C:\Users\kirill\Desktop\go_appengine\\dev_appserver.py", line 83, in <module>
    _run_file(__file__, globals())
  File "C:\Users\kirill\Desktop\go_appengine\\dev_appserver.py", line 79, in _run_file
    execfile(_PATHS.script_file(script_name), globals_)
NameError: name 'execfile' is not defined
error while running dev_appserver.py: exit status 1
  • 写回答

1条回答 默认 最新

  • dth62818 2016-02-25 07:03
    关注

    Go AppEngine SDK requires Python 2.7 (Python 3.x cannot be used). It looks to me your SDK is using Python 3.X or you don't have Python at all (in your PATH).

    First make sure Python 2.7 is added to your PATH so that will be used by goapp. You can get it here: Python 2.7.11. For the Go AppEngine SDK a small, portable Python is also enough, you can get it from here: Single-File Stand-alone Python 2.7.9 for Windows. Download pyexe-2.7.9.10.zip and extract it. It's just a 10 MB single file, rename it to python.exe and add it to your PATH.

    Also going further, it looks to me you are starting your Hello world app from the wrong folder: you are standing in the SDK's folder, and you want to start it specifying that your app is in the myapp subfolder inside your SDK, which is unlikely.

    Navigate to the folder where you app is (app.yaml must be there). In that folder execute the command

    goapp serve
    

    This will start the app being in the current folder. For this to work, the goapp command (goapp.bat on windows) must be added to your PATH.

    If you can't or don't want to add your go_appengine folder to your PATH, still navigate to the folder containing the app you want to start, but provide the path for goapp, e.g.

    C:\Users\kirill\Desktop\go_appengine\goapp serve
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 孟德尔随机化结果不一致
  • ¥15 深度学习残差模块模型
  • ¥50 怎么判断同步时序逻辑电路和异步时序逻辑电路
  • ¥15 差动电流二次谐波的含量Matlab计算
  • ¥15 Can/caned 总线错误问题,错误显示控制器要发1,结果总线检测到0
  • ¥15 C#如何调用串口数据
  • ¥15 MATLAB与单片机串口通信
  • ¥15 L76k模块的GPS的使用
  • ¥15 请帮我看一看数电项目如何设计
  • ¥23 (标签-bug|关键词-密码错误加密)