本文介绍了Google App Engine:“没有名为google.appengine.ext的模块”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  Traceback(最近一次调用最后一次):$ b在测试main.py GAE应用程序时遇到此错误: $ b文件main.py,第4行,位于< module> 
from google.appengine.ext import db
ImportError:没有名为google.appengine.ext的模块

我读了很多关于它的信息,但我找不到答案......任何想法或帮助?
Thank you guys !!

解决方案

测试我的应用程序时遇到同样的问题。我发现我的 / usr / local / google_appengine 包含了 google python模块,因此我将该路径添加到 $ PYTHONPATH 环境变量。您可以通过两种方式来完成此操作:在您的控制台中,键入 export PYTHONPATH =$ PYTHONPATH :在/ usr /本地/ google_appengine。这会将它添加到你的PYTHONPATH中进行这个控制台会话。 在你的shell配置文件中(也许〜/ .bash_profile

  export PYTHONPATH =$ PYTHONPATH:/ usr / local / google_appengine 

然后打开一个新的控制台会话或使用 source〜/ .bash_profile (或任何您的文件)


您可能必须修改此项,因为a)您的google_appengine文件夹位于不同的位置(不是 / usr / local )或者b)您的操作系统以不同的方式分隔路径(我认为windows使用; 而不是 - 我在Mac上)


Im getting this error when testing my main.py GAE application:

Traceback (most recent call last):
  File "main.py", line 4, in <module>
    from google.appengine.ext import db
ImportError: No module named google.appengine.ext

I read a lot about it but i can´t find the answer...any ideas or help?Thank you guys!!

解决方案

I had the same problem when testing my app. I found that my /usr/local/google_appengine contained the google python module, so I added that path to my $PYTHONPATH environment variable. You can do this in 2 ways:

  1. In your console, type export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine". This will add it to your PYTHONPATH for this console session.

  2. In your shell profile file (perhaps ~/.bash_profile), add a line like this:

    export PYTHONPATH="$PYTHONPATH:/usr/local/google_appengine"
    

    Then either open a new console session or reload your profile with source ~/.bash_profile (or whatever your file is)

You may have to modify this because a) your "google_appengine" folder is in a different location (not /usr/local) or b) your OS separates paths differently (I think windows uses ; instead of : -- I'm on a Mac)

这篇关于Google App Engine:“没有名为google.appengine.ext的模块”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 16:42