[Programming/Python] 컴파일 및 디컴파일
Python 메뉴얼 컴파일 자료
py_compile 이용하는 방법
https://docs.python.org/3/library/py_compile.html
py_compile — Compile Python source files — Python 3.8.1 documentation
py_compile — Compile Python source files Source code: Lib/py_compile.py The py_compile module provides a function to generate a byte-code file from a source file, and another function used when the module source file is invoked as a script. Though not ofte
docs.python.org
compileall 이용하는 방법
https://docs.python.org/3/library/compileall.html
compileall — Byte-compile Python libraries — Python 3.8.1 documentation
compileall — Byte-compile Python libraries Source code: Lib/compileall.py This module provides some utility functions to support installing Python libraries. These functions compile Python source files in a directory tree. This module can be used to create
docs.python.org
스택오버플로우 참고
https://stackoverflow.com/questions/5607283/how-can-i-manually-generate-a-pyc-file-from-a-py-file
How can I manually generate a .pyc file from a .py file
For some reason, I can not depend on Python's "import" statement to generate .pyc file automatically Is there a way to implement a function as following? def py_to_pyc(py_filepath, pyc_filepath):...
stackoverflow.com
Python 디컴파일 방법
.pyc 파일을 .py 파일로 만드는 방법에는 "uncompyle6" 라는 것이 있다.
https://github.com/rocky/python-uncompyle6
rocky/python-uncompyle6
A cross-version Python bytecode decompiler. Contribute to rocky/python-uncompyle6 development by creating an account on GitHub.
github.com
pip install uncompyle6
// example
uncompyle6 <파일명>.pyc
py2exe 로 생성한 파일에서 소스파일 추출
unpy2exe 를 이용한다. 이것을 이용하면 exe파일에서 .pyc 파일을 얻어낼 수 있다.
https://github.com/matiasb/unpy2exe
matiasb/unpy2exe
Extract .pyc files from executables created with py2exe - matiasb/unpy2exe
github.com