//2018.6.8 to update
There are... In the computer at the same time Python2 and Python3 Two versions , Doubt is generation pyc When it fails, it runs Python2
// I'm the divider ~~~~~~~~~~
A project needs to be python The script turns to pyc To encrypt , The code is simple , Just like the following code , But use python shell And double click python The script has two sizes pyc file , The latter is bigger . Another experiment was run on the console , And double click python Script generated pyc The file size is the same .
import py_compile py_compile.compile('test.py')
Then carry out the actual operation ,python ide Generated pyc It can be used , The latter two methods generate pyc Will report a mistake ...