【问题标题】:from cryptography.hazmat.bindings._constant_time import lib ImportError: No module named _constant_timefrom cryptography.hazmat.bindings._constant_time import lib ImportError: No module named _constant_time
【发布时间】:2018-04-08 15:40:51
【问题描述】:

我基本上是在使用 pywebpush(https://github.com/web-push-libs/pywebpush) 的应用引擎中部署一个烧瓶应用。我按照以下教程进行部署(https://cloud.google.com/appengine/docs/standard/python/getting-started/python-standard-env)但是我在应用程序引擎中不断收到错误,而它在本地系统中运行良好。 错误是:“从 cryptography.hazmat.bindings._constant_time 导入库 ImportError:没有名为 _constant_time 的模块”。 有人可以帮我解决这个问题吗?

【问题讨论】:

    标签: python google-app-engine python-cryptography


    【解决方案1】:

    该库在 App Engine 中是 not included,因此,您必须包含它。

    按照Copying a third-party library 中的命令(在您的情况下使用pywebpush)来执行此操作。

    编辑:pywebpush 依赖于带有 C 扩展的库,can not be used in Standard。为了能够使用 pywebpush,您必须迁移到 App Engine Flexible。我关注了this example,添加了pywebpush 依赖项并从中调用了一个函数,它在本地和部署中都有效。

    【讨论】:

    • 您好,我再次检查,发现pywebpush 库依赖于具有C 扩展的库。请检查我编辑的答案。
    • 谢谢。这是对问题的正确解释。
    猜你喜欢
    • 2017-02-20
    • 2018-01-03
    • 2017-11-02
    • 2017-10-04
    • 2015-05-01
    • 2020-09-23
    • 2015-08-28
    • 2015-03-30
    • 2012-10-24
    相关资源
    最近更新 更多