Uncompyle6 works for Python 3.x and 2.7 - recommended option as it's most recent tool, aiming to unify earlier forks and focusing on automated unit testing. The GitHub page has more details.
With these tools, you get your code back including variable names and docstrings, but without the comments.
The older Uncompyle2 supports Python 2.7 only. This worked well for me some time ago to decompile the .pyc bytecode into .py, whereas unpyclib crashed with an exception.
You may try Easy Python Decompiler. It's based on Decompyle++ and Uncompyle2. It's supports decompiling python versions 1.0-3.3
Note: I am the author of the above tool.
Yes, you can get it with unpyclib
that can be found on pypi.
$ pip install unpyclib
Than you can decompile your .pyc file
$ python -m unpyclib.application -Dq path/to/file.pyc
Yes.
I use uncompyle6 decompile (even support latest Python 3.8.0):
uncompyle6 utils.cpython-38.pyc > utils.py
and the origin python and decompiled python comparing look like this:
so you can see, ALMOST same, decompile effect is VERY GOOD.
Decompyle++ (pycdc) was the only one that worked for me: https://github.com/zrax/pycdc
was suggested in Decompile Python 2.7 .pyc
Yes, it is possible.
There is a perfect open-source Python (.PYC) decompiler, called Decompyle++ https://github.com/zrax/pycdc/
Decompyle++ aims to translate compiled Python byte-code back into valid and human-readable Python source code. While other projects have achieved this with varied success, Decompyle++ is unique in that it seeks to support byte-code from any version of Python.
Install using pip install pycompyle6
pycompyle6 filename.pyc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With