Decompiling Python-compiled pyc files back into py files

You can use the uncompyle6 tool.

You can install it directly with pip:

pip install uncompyle6

The decompile command (two forms):

uncompyle6 xxx.pyc > xxx.py
uncompyle6 -o xxx.py xxx.pyc

Example:

uncompyle6 utils.pyc > utils.py

Author: Tang Moying

Source: /en/post/decompile-pyc-file

License: this article is shared under "CC BY 4.0". Please credit the author and link back to the original when republishing.