5

I have a python code which uses the pygkt, gtk, ctypes, os and some other modules. I used pyinstaller to create a stand-alone executive of the code. It worked fine on ubuntu. Now I wanted to create another stand-alone executive for windows platform. I used the tool https://github.com/paulfurley/python-windows-packager for it and followed the steps. But I got the error: module gtk not found. How to fix the issue ? Are there any other tools to convert python code to stand-alone executable for windows os ? If yes, please provide the details ? Thank you

2 Answers 2

12

I'd recommend using pyinstaller

Example:

$ pip install pyinstaller
$ pyinstaller -F myscript.py

You should now have a build/myscript/myscript.exe executable.

Sign up to request clarification or add additional context in comments.

3 Comments

Thanks it worked. But needed to install pywin32, and pygtk.msi file for it to work. And the executable is stored in sample/dist/myscript.exe
great man , py2exe gave me resource error but pyinstaller worked for me , thanks :)
Aged thread, still useful. Using 3.7, this syntax worked for me: "py pyinstaller.py --onefile --noconsole scriptName.py"
3

If in Windows, Best way to do it is via Cygwin. Ensure you have Python 3.5+ version not 3.6

pip install pyinstaller

Go to the directory where the .py file is which needs to be packaged.

Then run

$ pyinstaller --onefile test.py

Simple to have a single file executable.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.