CppLearner
CppLearner

Reputation: 17040

How can I make portable python desktop application?

The requirement is to make an application portable, meaning no installer. I looked at py2exe and I am afraid I need to run install if I want to run it under Windows.

So my question is, can I make a portable python desktop application without any installation (all dependencies and libs are packaged), dragging from USB / CD will run it?

(This is critical because it's a headache for users to install C++ Run Time library...)

Thanks.

Upvotes: 17

Views: 21552

Answers (2)

Perica Zivkovic
Perica Zivkovic

Reputation: 2630

You can also fork Portable Python and modify to include your application and libraries you need. It runs from any drive/network location without installation and you can pick do you want 2.x.x or 3.x.x based Python core

Upvotes: 4

Steven T. Snyder
Steven T. Snyder

Reputation: 6177

You can use this method with py2exe: http://www.py2exe.org/index.cgi/SingleFileExecutable

Basically, you use NSIS to package all of the required files and folders into a single executable. When you run it, the required files are expanded to a temporary directory, the executable is run, and when it exits, the temporary files are deleted automatically.

There is also an example that comes with py2exe which uses Inno Setup instead of NSIS to achieve the same result. It's installed to site-packages\py2exe\samples\extending.

Upvotes: 10

Related Questions