简体   繁体   English

无法导入appengine python模块

[英]Can't import appengine python module

On my local machine I am unable to import appengine.ext module. 在我的本地计算机上,我无法导入appengine.ext模块。

I have set the path using the following code 我已经使用以下代码设置了路径

>>> import sys
>>> sys.path.insert(1, '/usr/local/google_appengine')
>>> sys.path.insert(1, '/usr/local/google_appengine/lib/yaml/lib')

Here is the error 这是错误

Python 2.7.10 (default, Jul 14 2015, 19:46:27) 
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path.insert(1, '/usr/local/google_appengine')
>>> sys.path.insert(1, '/usr/local/google_appengine/lib/yaml/lib')
>>> from google import appengine
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name appengine
>>> from google.appengine.ext import ndb
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named appengine.ext
>>> 

you should try to add the following code to the begining: 您应该尝试将以下代码添加到开头:

import dev_appserver
dev_appserver.fix_sys_path()

should work :). 应该管用 :)。

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

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