WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Standalone executable file  (Read 3996 times)

Offline Aladin

  • Newbie
  • *
  • Posts: 40
Standalone executable file
« on: May 21, 2020, 05:20:09 AM »
Hello all! I'm writing a Python program that uses a lot of dependencies and Python libraries. How can I convert this Python file into one standalone executable file that can run on PiCore 10.0 Beta? This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14824
Re: Standalone executable file
« Reply #1 on: May 21, 2020, 05:46:08 AM »
You could make one large extension?

btw - piCore-10.x is not actively maintained, you might be better off using the latest release, piCore-9.x, or the latest beta, piCore-11.x.

Offline jazzbiker

  • Hero Member
  • *****
  • Posts: 934
Re: Standalone executable file
« Reply #2 on: May 21, 2020, 05:52:56 AM »
Hello all! I'm writing a Python program that uses a lot of dependencies and Python libraries. How can I convert this Python file into one standalone executable file that can run on PiCore 10.0 Beta? This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.

On any computer running Windows )

Offline Aladin

  • Newbie
  • *
  • Posts: 40
Re: Standalone executable file
« Reply #3 on: May 21, 2020, 08:45:32 AM »
Hello all! I'm writing a Python program that uses a lot of dependencies and Python libraries. How can I convert this Python file into one standalone executable file that can run on PiCore 10.0 Beta? This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.

On any computer running Windows )


i don't understand

Offline Aladin

  • Newbie
  • *
  • Posts: 40
Re: Standalone executable file
« Reply #4 on: May 21, 2020, 08:46:58 AM »
You could make one large extension?

btw - piCore-10.x is not actively maintained, you might be better off using the latest release, piCore-9.x, or the latest beta, piCore-11.x.

i will use piCore-9.x but i don't understand you with make one large extension

Offline Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14824
Re: Standalone executable file
« Reply #5 on: May 21, 2020, 09:46:32 AM »
Copy all the files you want to include to, say, /tmp/pkg preserving the directory structure and permissions and then:
Code: [Select]
$ tce-load -i squashfs-tools
$ cd /tmp
$ sudo mksquashfs pkg/ mybigextension.tcz

You can then copy mybigextension.tcz to /mnt/mmcblk0p2/tce/optional and set it to load "onboot".

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11643
Re: Standalone executable file
« Reply #6 on: May 21, 2020, 10:09:27 AM »
Hi Aladin
... This way I can distribute my program to anyone that has a rpi and run it without having to install any other required files. ...
So it sounds like you are trying to create a self contained package that will run on any PI running any Linux.

Quote
... For example on Windows I use PyInstaller to create a .exe file that I am able to run on any computer.
From:
https://www.pyinstaller.org/
Quote
PyInstallers main advantages over similar tools are that PyInstaller works with Python 2.7 and 3.5-3.7, it builds smaller executables thanks to transparent compression, it is fully multi-platform, and use the OS support to load the dynamic libraries, thus ensuring full compatibility.
Python versions 2.7, 3.5, and 3.6 are all available in piCore-9.x.

Quote
PyInstaller Quickstart

Install PyInstaller from PyPI:

Code: [Select]
pip install pyinstaller
Go to your programs directory and run:

Code: [Select]
pyinstaller yourprogram.py
This will generate the bundle in a subdirectory called dist.

For a more detailed walkthrough, see the manual. https://pyinstaller.readthedocs.io/
So it sounds like if you install Python and set up pip, you should be able to install pyinstaller.