「Pythonのコードをバイトコンパイルする方法」の版間の差分
提供: Python入門
(ページの作成:「Pythonのコードは、バイトコンパイルできます。 __TOC__ == 概要 == Pythonのバイトコンパイル済のキャッシュファイルの拡張子は...」) |
|||
| 行17: | 行17: | ||
<syntaxhighlight lang="bash"> | <syntaxhighlight lang="bash"> | ||
python -m compileall . | python -m compileall . | ||
| + | </syntaxhighlight> | ||
| + | == バイトコンパイル済ファイルのファイルタイプ == | ||
| + | <syntaxhighlight lang="bash"> | ||
| + | % file foo.py | ||
| + | foo.pyc: DBase 3 data file (1390572897 records) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
== 関連項目 == | == 関連項目 == | ||
{{introduction}} | {{introduction}} | ||
<!-- vim: filetype=mediawiki --> | <!-- vim: filetype=mediawiki --> | ||
2014年1月25日 (土) 09:23時点における版
Pythonのコードは、バイトコンパイルできます。
概要
Pythonのバイトコンパイル済のキャッシュファイルの拡張子は、.pycです。
バイトコンパイル方法
python -m compileall foo.py
実行例
% python -m compileall foo.py Compiling foo.py ...
カレントディレクトリ以下のファイルをバイトコンパイルする
python -m compileall .
バイトコンパイル済ファイルのファイルタイプ
% file foo.py foo.pyc: DBase 3 data file (1390572897 records)