ImportError:没有名为google.appengine.api的模块

时间:2017-05-26 12:36:42

标签: python google-app-engine flask

当我迁移数据库时,我看到了错误。

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

和。 migrate(python manager.py db migrate)

我使用谷歌应用引擎,烧瓶,mac,python

我该怎么办?

$ 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

1 个答案:

答案 0 :(得分:0)

正如错误建议的那样,您的运行时环境无法找到该模块。按照以下说明将其安装在您的虚拟环境中或全局安装: https://cloud.google.com/appengine/downloads#Google_App_Engine_SDK_for_Python