2017-05-26 53 views
0

当我迁移我的数据库时,我看到该错误。ImportError:没有模块名为google.appengine.api

我做了init。 (python manager.py db init)

和。迁移(蟒蛇manager.py DB迁移)

我使用谷歌应用程序引擎,烧瓶,MAC,蟒蛇

我应该怎么办?

$ python manager.py db migrate 
/Library/Python/2.7/site-packages/flask_sqlalchemy/__init__.py:839: FSADeprecationWarning: SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and will be disabled by default in the future. Set it to True or False to suppress this warning. 
    'SQLALCHEMY_TRACK_MODIFICATIONS adds significant overhead and ' 
Traceback (most recent call last): 
    File "manager.py", line 3, in <module> 
    manager.run() 
    File "/Library/Python/2.7/site-packages/flask_script/__init__.py", line 412, in run 
    result = self.handle(sys.argv[0], sys.argv[1:]) 
    File "/Library/Python/2.7/site-packages/flask_script/__init__.py", line 383, in handle 
    res = handle(*args, **config) 
    File "/Library/Python/2.7/site-packages/flask_script/commands.py", line 216, in __call__ 
    return self.run(*args, **kwargs) 
    File "/Library/Python/2.7/site-packages/flask_migrate/__init__.py", line 182, in migrate 
    version_path=version_path, rev_id=rev_id) 
    File "/Library/Python/2.7/site-packages/alembic/command.py", line 176, in revision 
    script_directory.run_env() 
    File "/Library/Python/2.7/site-packages/alembic/script/base.py", line 421, in run_env 
    util.load_python_file(self.dir, 'env.py') 
    File "/Library/Python/2.7/site-packages/alembic/util/pyfiles.py", line 93, in load_python_file 
    module = load_module_py(module_id, path) 
    File "/Library/Python/2.7/site-packages/alembic/util/compat.py", line 75, in load_module_py 
    mod = imp.load_source(module_id, path, fp) 
    File "migrations/env.py", line 87, in <module> 
    run_migrations_online() 
    File "migrations/env.py", line 70, in run_migrations_online 
    poolclass=pool.NullPool) 
    File "/Library/Python/2.7/site-packages/sqlalchemy/engine/__init__.py", line 428, in engine_from_config 
    return create_engine(url, **options) 
    File "/Library/Python/2.7/site-packages/sqlalchemy/engine/__init__.py", line 387, in create_engine 
    return strategy.create(*args, **kwargs) 
    File "/Library/Python/2.7/site-packages/sqlalchemy/engine/strategies.py", line 80, in create 
    dbapi = dialect_cls.dbapi(**dbapi_args) 
    File "/Library/Python/2.7/site-packages/sqlalchemy/dialects/mysql/gaerdbms.py", line 68, in dbapi 
    from google.appengine.api import apiproxy_stub_map 
ImportError: No module named google.appengine.api 
+0

谷歌是否在您的路径上?打开Python解释器并输入“google”,看看会发生什么。 –

回答

0

由于错误提示,您的运行时环境找不到该模块。请按照说明将其安装在虚拟环境中或全局安装: https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python

+0

我已经安装了GAE SDK for python .... –

+0

您是否尝试过检查库路径,如果模块在那里?尝试导入然后打印sys.path,然后查找提到的库。如果它不在那里,你可以尝试点击卸载谷歌然后gcloud并按顺序再次安装 – Linh

相关问题