ubantu 18.04 下将函数加密为.so文件

2022-08-01,,,,

1.准备工作:

python3-dev的安装

sudo apt-get install python3-dev

如使用上述命令出现缺少各种依赖项可以使用以下两行代码实现安装:

sudo apt-get install aptitude
sudo aptitude install python3-dev

#(依次输入 n, y, y 实现安装)

cython的安装:

apt-get install cython cython3

 

 

 

setup.py脚本的内容

 

from distutils.core import setup
from Cython.Build import cythonize
setup(
ext_modules = cythonize("test.py"),
)

使用命令

python3 setup.py build_ext

生成.c和.so文件,需要将.so文件放到和usetest.py同一目录下才可以正常运行

 

如何引入.so文件:

from test import new     #new为test文件中加密函数的名称

new()

 

本文地址:https://blog.csdn.net/chenqixianghahah/article/details/107392947

《ubantu 18.04 下将函数加密为.so文件.doc》

下载本文的Word格式文档,以方便收藏与打印。