ICode9

精准搜索请尝试: 精确搜索
首页 > 系统相关> 文章详细

关于Linux安装SEAL-python心得

2021-08-23 22:03:53  阅读:397  来源: 互联网

标签:git python Linux github build https SEAL com


github网站:https://github.com/Huelse/SEAL-Python
我是参考该github的README,在linux环境下安装SEAL-Python,期间遇到一些问题,我修改了一下原来的指令,以下是我的经验。

安装方法

原文档的步骤

Linux
Clang++ (>= 5.0) or GNU G++ (>= 6.0), CMake (>= 3.12)

# Optional
sudo apt-get install git build-essential cmake python3 python3-dev python3-pip

# Get the repository or download from the releases
git clone https://github.com/Huelse/SEAL-Python.git
cd SEAL-Python

# Numpy is essential
pip3 install -r requirements.txt

# Init the SEAL and pybind11
git submodule update --init --recursive
# Get the newest repositories (unnecessary)
# git submodule update --remote

# Build the SEAL lib
cd SEAL
cmake -S . -B build -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF -DSEAL_USE_ZSTD=OFF
cmake --build build
cd ..

# Run the setup.py
python3 setup.py build_ext -i

详细参照原github地址

问题与解决

1.git clone https://github.com/Huelse/SEAL-Python.git
我使用的是实验室的服务器,用的网络比较差,下载太慢,一开始clone失败,可以改为:
git clone git://github.com/Huelse/SEAL-Python.git

2.git submodule update --init --recursive
同样可能是由于网络问题,在更新子仓库的时候,报错
fatal: clone of 'https://github.com/pybind/pybind11.git' into submodule path '/xxx/xxx/SEAL-Python/pybind11' failed
我去issue向原作者提问,他的解答是:查看http://git-scm.com/docs/git-submodule or git submodule init && git submodule update

之后我用这个方法无法解决问题,我的解决思路还是修改url
git submodule update 更新的原理是根据.gitmodules文件中的url进行更新
可以在linux系统下使用vim进入编辑器模式,修改其中url地址
我的做法:

https://github.com/microsoft/SEAL.git改为 https://github.com.cnpmjs.org/microsoft/SEAL.git
https://github.com/pybind/pybind11.git改为 https://github.com.cnpmjs.org/pybind/pybind11.git

cd SEAL
cmake -S . -B build -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF -DSEAL_USE_ZSTD=OFF
cmake --build build

提示:
The source directory /xx/build does not exist

  • 首先看了cmake的文档

    文档上写着“构建根目录如果不存在将会自动创建”,但是我就没有自动创建
  • 建议新建build文件进行编译
mkdir build
cd build
cmake -S ../ build -DSEAL_USE_MSGSL=OFF -DSEAL_USE_ZLIB=OFF -DSEAL_USE_ZSTD=OFF
  • 然后返回SEAL目录下
cd ..
cmake --build build

结语

可能是由于网络原因安装过程还挺麻烦的,我想把经验分享给遇到相同问题的朋友们。如果遇到问题是在找不到解决方案,主要要学会看文档把原理搞懂,然后摸索是哪部分出了问题。

参考

https://github.com/Huelse/SEAL-Python
https://www.jianshu.com/p/1e704e20eab8
https://blog.csdn.net/King_key/article/details/111595201

标签:git,python,Linux,github,build,https,SEAL,com
来源: https://www.cnblogs.com/zhengkaixin/p/15177890.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有