当前位置:编程学习 > 网站相关 >>

把py文件编译为pyc文件

把一个py文件编译为pyc文件了。(假设在windows环境下)
import py_compile
py_compile.compile(r'H:\game\test.py')
py_compile.compile('webmail_sina.py') # Linux环境

批量生成pyc文件
>>> import compileall
>>> compileall.compile_dir(r'/home/codemo/Desktop/python')

 

摘自 代码示例[codemo]
补充:Web开发 , Python ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,