使用uncompyle2反编译* .pyc文件

时间:2016-12-31 11:13:29

标签: python git

我正在尝试使用uncompyle2(https://github.com/wibiti/uncompyle2)反编译* .pyc文件。所以我要做的第一步是克隆git

git clone https://github.com/wibiti/uncompyle2

下一步是写

cd uncompyle2/

然后

python setup.py install

一切都很好,但是当我试图写出可能的求助命令时

uncompyle2 -h

仅显示

bash: uncompyle2: command not found

我做错了什么?

我的环境路径是:C:\ Python27,我的python版本是2.7。 我正在尝试反编译的Python文件版本也是2.7。系统是Windows 8。

1 个答案:

答案 0 :(得分:1)

cmd上,您需要从Scripts文件夹运行脚本uncompyle2,该文件应位于C:\Python27\Scripts

从IDLE你可以做到这样

import uncompyle6

with open("uncompiled file.py", "wb") as fileobj:
    uncompyle6.uncompyle_file("afile.pyc", fileobj)