Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 574
CppLearner Avatar asked Mar 02 '12 19:03

CppLearner


2 Answers

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.

like image 165
Steven T. Snyder Avatar answered Oct 11 '22 14:10

Steven T. Snyder


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

like image 28
Perica Zivkovic Avatar answered Oct 11 '22 15:10

Perica Zivkovic