首页 > 编程语言 > 详细

对python源码进行编译,加密python脚本

时间:2019-05-04 16:20:49      阅读:176      评论:0      收藏:0      [点我收藏+]
对python源码进行编译
1.生成.pyc文件
import py_compile
py_compile.compile(‘hello.py‘)
2.优化源码文件
python -O -m py_compile 1.py
生成.pyo文件
 
例子:
 1 [root@lvs-master tool]# python3
 2 Python 3.5.6 (default, May  3 2019, 01:52:28) 
 3 [GCC 4.8.5 20150623 (Red Hat 4.8.5-36)] on linux
 4 Type "help", "copyright", "credits" or "license" for more information.
 5 >>> import py_compile
 6 >>> py_compile.compile(test_conn_linux.py)
 7 __pycache__/test_conn_linux.cpython-35.pyc
 8 >>> 
 9 >>> exit
10 Use exit() or Ctrl-D (i.e. EOF) to exit
11 
12 #执行部分
13 [root@lvs-master __pycache__]# python3 test_conn_linux.cpython-35.pyc
14   序号:0       选择对象:172.16.132.4
15   序号:1       选择对象:192.168.1.111
16   序号:2       选择对象:47.106.169.222
17   序号:3       选择对象:172.16.132.3
18 请输入序号(Q|q退出)

 

对python源码进行编译,加密python脚本

原文:https://www.cnblogs.com/dennymami/p/10808720.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!