百度云链接下载
链接:https://pan.baidu.com/s/1H7MQPL4d3wOi0K6D5hRtOA
或者
github链接下载
https://github.com/Falldog/pyconcrete
将pyconcrete-master.zip放在linux环境下, 并解压缩
我用的是Ubuntu 64位 18
python setup.py install --install-lib=/home/cxg/my_code --install-scripts=/home/cxg/my_code
安装过程需要输入secret_key
待加密的文件放在前面安装的文件夹下,
执行命令python pyconcrete-admin.py compile --source=待加密文件名.py --pye --remove-py
比如我待加密的文件是test.py
在my_code目录下执行命令
python pyconcrete-admin.py compile --source=test.py --pye --remove-py
执行后,加密完成待加密的文件夹放在前面安装的文件夹下,执行shell脚本加密
比如我待加密的文件夹是mypy,放在my_code目录下
#!/bin/bashfor file in ./*doif [ -d "$file" ]then echo "$file is dir" if [ "pyconcrete" == `basename $file` ] then echo "$file is dir and not need compile" else python pyconcrete-admin.py compile --source=$file --pye --remove-py --remove-pyc echo "$file encrypt success" fielif [ -f "$file" ]then echo "$file is file"fidone
用命令chmod 700 crt_pye.sh给shell脚本加可执行权限
输入命令./crt.sh执行shell脚本
未加密的的.py如果需要调用加密后的.pye,需要在.py文件添加
import pyconcrete
比如call_func.py脚本未被加密,其中import了gen_pd_date_range,
call_func.py代码如下:
import pandas as pdimport numpy as npimport datetimeimport warningswarnings.filterwarnings("ignore")#需引入pyconcretefrom pyconcrete import *#mypy.gen_pd_date_range是pye文件from mypy.gen_pd_date_range import *start_date, end_date = '2019-02-01', '2019-10-31'print(gen_pd_date_range(start_date, end_date))
执行call_func.py, 可以正常运行
联系客服