L
L
l3372015-10-19 17:12:16
Python
l337, 2015-10-19 17:12:16

Is it possible to run a Python script on an external device?

The essence of the problem: there is a Python script with external dependencies, in particular PyQT (as well as others).
Since PyQT is cross-platform, I'm going to run it on Windows, Linux, Mac (officially supported).
How to assemble a program from this with the elimination of all dependencies? So that you can store it on a portable device and run it from it? It also needs to be one file (see below).
Solutions:
For Windows, you can build an exe, for example, using PyInstaller (should work on all versions of Windows) - it suits.
With Unix, actually, and a hitch. There are a lot of options:
1) Wheels
2) Buildout
3) Virtualenv
And so on, I will immediately make a reservation that all dependencies must be removed without the Internet!
So far, the simplest, in my opinion, is to build Virtualenv and put it next to the script on a portable device. In the script, specify the path to the interpreter for the virtual environment (I did not check whether this would work).
Thus, we have 2 files program.exe and program.py. Windows user runs .exe, and Linux and Mac user .py
Tell me if my version will work or suggest your own.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dimonchik, 2015-10-19
@l337

docs.python-guide.org/en/latest/shipping/freezing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question