Making your python code execute on all computers - python

I have written a python GUI application.I want to run the code on my friend's computer who doesn't have python interpreter in his computer and that he can't download since he can't connect to the internet.How do I make that happen?

Use py2exe (for Windows), py2app (for Mac), or cx_freeze (for Linux) to bundle the Python interpreter, your program, and the standard library into an executable you can use on a machine with no Python at all.
PS: If your friend's computer isn't on the Internet, however you'd get him your program, you can also get him the kits for Python, etc.

py2exe is a library that allows you to compile Python executables for Windows. There's also cx_Freeze, which is cross-platform.

Related

Bundling Python script to run on different Macs

I wrote a Python script that scrapes PDFs that are in the same directory as the file itself.
I used pyinstaller on my Mac to convert this to a onefile .exe on my MacBook Pro and it works great. However, when I try to send this file to someone else via email, it doesn't open because "it's a Windows file", despite the fact that it was compiled/bundled on a Mac. The modules I use are regex, PyPDF2, among other non-standard libraries. How do I make these executables run on different computers?
I've tried using auto-py-to-exe, but to no avail.
The executables work as built on my Mac, but when I email it to someone whose Mac does not have Python/IDLE installed, I run into a wall. If it makes a difference, I've made a version for Windows, and that works great, too.
AFAIK, you need to compile Python programs separately for each environment. If you're on Linux, give crossenv a try.
If you aren't on Linux, to build packages that work on a Mac without IDLE installed, try py2app.
You can also suggest that whoever you're sending this file to install wine, which will let them run the .exe (though installing python might be a tad easier for them.)

Make python program standalone executable under linux

How to make python program standalone executable under linux
I have done some research but I am not looking for a way to make a script and run the .py file like answered in this question. What do I use on linux to make a python program executable
I am looking to "complie" the .py to a standalone program so users in a linux environment like ubuntu can run it out of the box without installing python and the libraries I used because no root access.
I found py2exe for windows. I would think there is a way to achieve this in linux?
Doesn't pyinstaller compile under the OS you are using?
if you want a windows exe - use pyinstaller in windows environment...
For Linux, use pyinstaller in Linux.
You can use Jython to compile it to JVM. Using the Jython compiler
jythonc [options] [module]*
This would, however, require Java to be installed...
There are also a couple of other resources to compile Python. From Compiling Python Code, some cross-platform tools are
Gordon McMillan’s installer (cross-platform)
Anthony Tuininga’s cx_Freeze (cross-platform)
but I do not know anything about those.

How to make Python program run on Mac?

I'm trying to find out how to make Python program work on Mac computer. I've built a program using many Python modules like lxml,selenium etc. (PhantomJS.exe) and I've created an exe file using Py2Exe which works correctly but now, I've realised that it should be able to be executed on Mac. Is there a simple way to do that?
There is a mac alternative of py2exe, called py2app.

Can the Python interpreter and Python app source code be embedded into a compiled program?

I want to put the Python interpreter and all the source files of a fairly large Python application with multiple .py files into an executable Linux file.
Thus when running the application, the Python interpreter will run the Python source code that is embedded into the executable.
Using Python 3.
Is such a thing possible?
Edit: in addition to the selected answer another option is to use Cython.
Sounds like you're looking for a packaging module, like py2exe or cx_Freeze (I prefer the latter). They bundle the interpreter and your files together so that a machine without an installation of Python can run your program.

is there any way to converts Python scripts into executable Windows programs on linux

is there any way to converts Python scripts into executable Windows programs on linux
i know py2exe and pyinstall will work well on windows
but i only has linux Environment
Why would you want to convert it to a windows executable on a linux platform? Anyway, I'd say you have two options:
Use py2exe with wine (a Windows emulator). I've done this, and it works
If that is not possible, you could try pyinstaller. I haven't tried it, but it seems to be sort of the same, but multi-platform
cx_Freeze will do you the job.
http://cx-freeze.sourceforge.net/

Categories

Resources