【问题标题】:ImportError: No module named google.appengine.apiImportError:没有名为 google.appengine.api 的模块
【发布时间】:2017-10-27 08:40:54
【问题描述】:

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

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

和。迁移(python manager.py db 迁移)

我使用谷歌应用引擎、flask、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

【问题讨论】:

  • 谷歌在你的道路上吗?打开python解释器和tyimport google,看看会发生什么。

标签: python google-app-engine flask


【解决方案1】:

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

【讨论】:

  • 如果模块存在,您是否尝试检查库路径?尝试导入然后打印 sys.path 然后查找提到的库。如果它不存在,您可以尝试 pip uninstall google 然后 gcloud 并按该顺序重新安装
猜你喜欢
  • 2018-07-11
  • 2013-03-11
  • 2012-12-07
  • 2012-05-23
  • 2019-07-29
  • 2015-07-04
  • 2014-03-15
  • 2017-12-29
  • 2014-09-12
相关资源
最近更新 更多