Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile to Windows exe.
#1
Hi everyone,

I'm looking for a compiler to complie .py to one single windows .exe (the compiler will run under windows also)

I've try already auto-py-to-exe but I'm not happy with it.

I've tried PyInstaller, but one of his dependency (that I need) is not working/maintain anymore and fail to install (PyCrypto) https://pyinstaller.readthedocs.io/en/st...n-bytecode

So impossible to use.

I've look also nuitka but it seem not possible to set an icon for the exe...

Did you have any compiler recommendation ?

Thanks
[Image: NfRQr9R.jpg]
Reply
#2
PyCrypto is only needed if you want to encrypt the python bytecode with PyInstaller. Do you really need that?
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
What about py2exe? I've never used, but i've heard of it multiple times.
Reply
#4
(Jul-05-2020, 07:07 AM)Knight18 Wrote: What about py2exe? I've never used, but i've heard of it multiple times.
py2exe has not been worked on since 2013,and only work up until Python 3.4,it fail on all newer Python version.
So the status now is that py2exe is dead.

Pyinstaller is really good,and as mention bye @buran the encrypt of bytecode is a feature that's really not needed at all for Pyinstaller to work.
There is work done for a replacement Replace PyCrypto with tinyaes
Reply
#5
Wow, didn't know that. Thanks, I learnt something new today.
Reply
#6
(Jul-05-2020, 07:43 AM)snippsat Wrote: ...
Pyinstaller is really good,and as mention bye @buran the encrypt of bytecode is a feature that's really not needed at all for Pyinstaller to work.
There is work done for a replacement Replace PyCrypto with tinyaes

Cool Thumbs Up , but I don't see how to use it (tinyaes) with Pyinstaller.
[Image: NfRQr9R.jpg]
Reply
#7
(Jul-06-2020, 04:44 AM)SpongeB0B Wrote: Cool , but I don't see how to use it (tinyaes) with Pyinstaller.
It not something you shall use,it's a feature for replacing the --key= command in future releases.

As mention there is no need to use this command to make a .exe.
Quick demo,take Tkinter code here find a icon example download the education ico.
No make folder eg to_exe,place .py and .ico file in this folder.
# Use <dir> in cmd
G:\div_code\to_exe
λ ls
education.ico  tk_hello.py

# Make sure pyinstaller is installed.
G:\div_code\to_exe
λ pip install pyinstaller --upgrade
.....
Requirement already satisfied, skipping upgrade: future in c:\python38\lib\site-packages (from pefile>=2017.8.1->pyinstaller) (0.18.2)
No is ready to use pyinstaller with this command:
pyinstaller --onefile --console --icon=education.ico tk_hello.py
G:\div_code\to_exe
λ pyinstaller --onefile --console --icon=education.ico tk_hello.py
218 INFO: PyInstaller: 3.6
219 INFO: Python: 3.8.3
220 INFO: Platform: Windows-10-10.0.18362-SP0
434 INFO: wrote G:\div_code\to_exe\tk_hello.spec
.....
15841 INFO: Building EXE from EXE-00.toc completed successfully.
tk_hello.exe will be in dist folder.
[Image: ljNTKq.png]
G:\div_code\to_exe
λ cd dist

G:\div_code\to_exe\dist
λ ls
tk_hello.exe*

# Gui start and as build with --console will now also see the return  
G:\div_code\to_exe\dist
λ tk_hello
hi there, everyone!
hi there, everyone!
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  How to compile a Python script for a Windows / Linux executable? netanelst 2 1,273 May-24-2022, 07:02 AM
Last Post: netanelst
  Cython: How to compile to 32bit Windows with MinGW gcc? PythonABC 0 5,531 May-21-2018, 07:36 PM
Last Post: PythonABC

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020