Reputation: 7218
I am working on a project which has below directory structure
MyPythonProject
-> configs
-> appconfig.json
-> logs
-> app.log
-> src
-> file1.py
-> file2.py
-> file3.py
app.py
app.py
is the main executable file which is also depended on python files inside src
. I want to convert app.py
to app.exe
which I can easily do using pyinstaller app.py
. This creates a dist
folder which has python and all the packages. I can simply copy paste the src
, configs
and logs
into dist and can easily share it with everyone.
But the problem is I do not want to share python files inside src
as it is because it can easily accessed by anyone. I want to convert it into binary executable so that no one can convert or de-compile back into .py
files.
For this, I can use auto generated .pyc
files but I believe this can also be de-compiled back to py
. Is there any way I can convert into some kind of binary which can never be de-compiled. Does pyinstaller do this. Is there any command available in pyinstaller which while converting app.py
also converts rest of the python files into executable. Please help. Thanks
Upvotes: 0
Views: 3562
Reputation: 5746
If you are importing the additional scripts, pyinstaller
will gather those imports and automatically include them.
You can use --onefile
to ensure only the exe
is created for distribution.
pyinstaller --onefile app.py
Upvotes: 2