SEAL-Python Win11环境下安装

121 阅读1分钟

前言

SEAL-Python介绍:PySEAL:一个全同态加密的Python接口库 - 知乎
项目地址:Huelse/SEAL-Python: Microsoft SEAL 4.X For Python
git上已经有了win环境下的安装流程,但实际操作下来还是有不少坑,在此记录安装流程一下。

git上的安装流程

安装环境

c++编译器:MSVC2019,平时用QT,已经有了MSVC的环境。安装的内容如下:

image.png

cmake: v3.29.3 下载地址:cmake下载

image.png

ninja: v1.12.1 下载地址:ninja下载

image.png

python: python3.8.8 下载地址:python下载

image.png

需要可以在cmd中使用,若不行检查环境路径是否配置正确。

安装流程

1. 下载源文件

cmd中输入:

git clone https://github.com/Huelse/SEAL-Python.git

cd SEAL-Python\

git submodule update --init --recursive

git可能网络连接失败,多试几次,或者找gitee上的镜像。

image.png

2. 编译SEAL

打开x64 Native Tools Command Prompt for VS(按下win键,直接搜索)

image.png 移动到源码目录下的SEAL目录中

cd SEAL-Python

cd SEAL

cmake -S . -B build -G Ninja -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF

cmake --build build

image.png

3. 编译SEAL-Python

cmd中输入:

# Build
pip install numpy pybind11
python setup.py build_ext -i

# Test
cp seal.*.pyd examples
cd examples
python 4_bgv_basics.py

image.png

image.png

大功告成!

以下步骤将库安装到pip list可见

python setup.py build

python setup.py install

image.png