1.mytest.py 需要加密的内容
#coding:utf-8
import datetimeclass Today():def get_time(self):print(datetime.datetime.now())def say(self):print("hello word!")today = Today()
today.say()
today.get_time()
2.执行setup.py 也就是加密脚本
from distutils.core import setup
from Cython.Build import cythonizesetup(ext_modules=cythonize(["mytest.py"]), script_args=['build_ext', '--inplace'])
3.用so_test.py调用生成的.so文件
from mytest import Todayt = Today()
print('=====================')
t.say()
t.get_time()