从cryptography.hazmat.binding导入_constant_time

时间:2018-09-17 03:37:04

标签: cryptography

导入_constant_time时

我遇到归因错误:_init.cffi_1_0_external_module

我决定在_constant_time检查。 发现的是_constant_time不是python模块,而是cpp编译的库。 (.so)。

那么python如何从.so文件导入?还是加密软件包中缺少某些内容?

1 个答案:

答案 0 :(得分:1)

根据俄语StackOverflow上的an answer,您还需要安装cffi模块。

sudo easy_install -U cffi

sudo pip install -U cffi

在Windows上,语法更像是:

python -m pip install -U cffi

(根据How to run Pip commands from CMD?

在Windows上需要

-m,因为Windows不会解释“ shebang”(#!)解释器行,因此pip不能像在Linux / BSD / Unix /其他系统上那样直接运行,但是需要从python运行。 -U告诉pip或easy_install安装可用的最新版本的cffi

English version of linked Russian page