码迷,mamicode.com
首页 > 编程语言 > 详细

python编译模块为2禁制

时间:2014-09-28 18:13:23      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:on   c   代码   r   python   as   file   字符串   d   

编译模块为2禁制
yum -y install python26-setuptools
easy_install -U setuptools
# cd /usr/lib64/python2.6
# easy_install py_compile

python -O -m py_compile file.py

-O 优化成字节码
-m 表示把后面的模块当成脚本运行
-OO 表示优化的同时删除文档字符串


也可以写一个脚本来实现:
Python代码
import py_compile

py_compile.compile("file_path")

python编译模块为2禁制

标签:on   c   代码   r   python   as   file   字符串   d   

原文地址:http://www.cnblogs.com/diege/p/3998423.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!