对非程序员隐藏 Python 代码 [英] Hiding Python Code from non-programmers

查看:85
本文介绍了对非程序员隐藏 Python 代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何向客户混淆/隐藏我的 Python 代码,使他无法更改源代码?

How can I obfuscate / hide my Python code from the customer, so that he cannot change the source how he likes to?

我知道没有有效的方法可以隐藏 Python 代码,因此无法阅读它.我只是想要一个简单的保护,一个不知道自己在做什么的人不能只用文本编辑器打开源文件,然后轻松地进行更改或理解所有内容.因为我的代码写得很好理解,所以我想隐藏我最初使用的主要原则.

I know there is no effective way to hide Python code, so that there is no way to read it. I just want a simple protection, that someone who doesn't really know what he is doing cannot just open the source files with a text editor and make changes or understand everything easily with no effort. Because my code is written really understandable, I'd like to hide the main principles I used at the first place.

如果有人真的想了解我所做的一切,他会的.我知道.

If someone really wants to understand what I have done, he will. I know that.

那么有没有一种常用的方法可以对python代码进行简单的保护?

So is there a common method you use to make a simple protection for python code?

推荐答案

只需使用this answer中的方法将其编译为字节码.

import py_compile
py_compile.compile("file.py")

pyc 文件可以代替 py 文件分发.

The pyc file can be distributed in place of the py file.

这篇关于对非程序员隐藏 Python 代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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