문제

i want to remove my source code .py files to avoid rivals to see my code.

so i use

python -c "import compileall; compileall.compile_dir('D:/acc')"

to compile all py files to pyc,next step is to remove py files,and run the project only use pyc, how to do it?

도움이 되었습니까?

해결책

One convenient approach is to rename the main module pyc file to __main__.pyc and put all pyc files in a zip file. Python 2.6 and above are then able to run the zip:

python myapplication.zip

Be aware that pyc files are not compatible between different Python versions.

다른 팁

you can use shutils, which is in the standard lib but please consider that removing *.py files is not a very string protection as it is very easy to rebuild the *.py file from a *.pyc.

Using py2exe with a drm packer would be much more secure.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top