#-*-coding:cp936-*-#python#Xiaodeng#Python module Py_compile usage (convert py file to PYc file)#Binary files, which are generated by the Py file after compilation." "import py_compile# without escape rpy_compile.compile (' D:\test.py ') Traceback (most recent call last): File "<pyshell#1> ", line 1, <module> py_compile.compile (' D:\test.py ') File" C:\Python27\lib\py_compile.py ", line 106, in Compi Le with open (file, ' U ') as f:ioerror: [Errno] Invalid mode (' u ') or filename: ' D:\test.py ' #加r前缀py_compile. Compile (R ') D:\test.py ') #py文件完整的路径." "#cmd command operation modePython-m Py_compile Test.pypython-m Py_compile D:\test.pypython-M py_compile/root/src/{file1,file2}.py#- m is equivalent to the import in the script, where the-M py_compile is equivalent to the import py_compile
Python Module Py_compile usage (convert py file to PYc file)