How to decompile compiled .pyc Python files

Cassius
Cassandra
Published in
2 min readDec 25, 2020

--

How to use uncompyle6 to decompile .pyc files in your directory.

Step 1. Install uncompyle6

pip install uncompyle6

A native Python cross-version decompiler and fragment decompiler. The successor to decompyle, uncompyle, and uncompyle2.

Step 2. Run uncompyle6 from Windows command prompt

Make sure you have added your Python directory to Path in your environment variables. For instance, if you use an Anaconda distribution of Python, add the following to Path:

C:\Users\<username>\Anaconda3
C:\Users\<username>\Anaconda3\Scripts

This ensures that you can run uncompyle6 directly from Windows command prompt. You can test this out by simply typing uncompyle6 in your command prompt.

uncompyle6 in Windows Command Prompt

Step 3. Decompile .pyc file in your local directory

Go to the directory where you have your .pyc file which you want to decompile.

--

--

Cassius
Cassandra

writes about machine learning and programming.