python - 如何永远隐藏 Python 中的源代码?
问题描述
有没有办法确定我的源代码真的被隐藏了?我使用 pyinstaller 创建 exe,以便我的朋友可以在没有 python 的情况下使用我的应用程序。我的想法是使用 pyinstaller 中的所有文件创建一个 USB 磁盘,它们被锁定以防止读取代码。此应用程序只能通过桌面上的快捷方式启动。但是我没有找到解决方法。有人知道一种功能性的方法来锁定我的 python 应用程序而无需阅读代码以便仅使用它吗?
解决方案
import py_compile
py_compile.compile(filename, compiled_filename, optimize=2)
请注意:
您需要使用相同版本的 python 和所有用于启动此编译文件的库。
对于加载文件(例如:open("text.txt", "r")),您需要指定所有树(例如:open("C:/Users/Me/Desktop/MyProgram/test.txt", " r"))
推荐阅读
- mysql - 每日用户总数
- python - Sphinx - 从父方法插入参数文档
- android - 当请求获取远程数据时出现错误时,RxJava2 concatArrayEagerDelayError 不会加载缓存数据
- python - django-import-export:导入不起作用
- unix - 使用 sed 命令从第 2 次替换到第 4 次出现
- laravel - 当我制作 PDF 时,错误是 Laravel 的 dompdf 中的“尝试访问类型为 null 的值的数组偏移量”
- r - 搜索 Scopus 搜索 API 时出错并将结果批量保存到 xml 文件中
- react-native - 错误:无法从`index.js`解析模块`react`:在项目中找不到react
- reactjs - 如何获取要在打字稿的图像 ID 列中作为值输入的上传图像的标题?
- performance - 使用 Jmeter 的吞吐量和响应时间