如何将 exe 转换回 Python 脚本 [英] How to convert exe back to Python script

查看:170
本文介绍了如何将 exe 转换回 Python 脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我将 .py 文件转换为 .exe 文件.

Recently I converted a .py file to a .exe file.

我丢失了原始的 .py 文件,只剩下 exe 文件.我是用pyinstaller转换的.

I lost the original .py file and I'm left with the exe file. I converted it with pyinstaller.

无论如何要扭转这个以取回我原来的 .py 文件?

Is there anyway to reverse this to get my original .py file back?

推荐答案

  1. 使用pyinstxtractor.py:

     python pyinstxtractor.py yourFileName.exe

这将提取 .exe 并创建一个名为 yourFileName.exe_extracted 的文件夹.

This will extract .exe and create a folder named yourFileName.exe_extracted.

yourFileName.exe_extracted 文件夹中,找到没有任何扩展名的文件.

Inside the yourFileName.exe_extracted folder, find the file without any extension.

使用 HxD 编辑器进行编辑,并从使用相同版本的 Python 创建的任何 __pycache__ 文件中,复制第一行并将其插入到您的文件中.

Edit it with HxD editor and from any __pycache__ file created with the same version of Python, copy the first row and insert it into your file.

使用 .pyc 扩展名保存并重命名文件.

Save and Rename the file with .pyc extension.

使用任何在线工具(例如 https://www.toolnb.com/tools-lang-en/pyc.html

Decompile the compiled bytecode (.pyc) to .py using any online tool, like https://www.toolnb.com/tools-lang-en/pyc.html

这篇关于如何将 exe 转换回 Python 脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆