1

I want to convert .py file into an executable file and run on raspberry pi. I installed pyinstaller

sudo apt-get install pyinstaller
sudo pyinstaller test.py

This command create a test.spec file and dist folder.

cd dist/test

there i got a executable file named test. Now i want to run it

sudo ./test

error: ./test: 1: ./test: Syntax error: "(" unexpected

I install mono

sudo apt-get install mono-complete
sudo mono test.exe

error:

no such file on the directory

then i use

sudo mono test

error shows:

cannot open assembly'test':file does not contain a valid CIL image

How i could solve my problem. I want to convert my code(.py written in idle) into an executable file and run it on my raspberry pi.

Akash Nil
  • 693
  • 10
  • 26

1 Answers1

1

Renaming linux-32bits to linux-32bits-arm still produces x86 files. You need compile own linux-32bits-arm bootloader.

In your PyInstaller distribution directory run:

cd bootloader
sudo python ./waf configure --no-lsb all

Then copy whole ../PyInstaller/bootloader/linux-32bits-arm to directory where did you renamed that bootloader

After that it should work ok.

wallycz
  • 312
  • 3
  • 11
  • i am not familiar with this process. kindly elaborate it. what does cd bootloader means is it cd /usr/local/lib/python2.7/dist-packages/PyInstaller/bootloader??? i issued the command from lx terminal here the compilers remains linux-64bit and linux -32bits know what i have to do??? – Akash Nil Feb 16 '16 at 12:02
  • from lx terminal i issued sudo python ./waf configure --no-lsb all error: cannot open ./waf: no such file – Akash Nil Feb 16 '16 at 12:06
  • This is not right directory, you must download package with sources from https://github.com/pyinstaller/pyinstaller/releases/download/v3.1/PyInstaller-3.1.zip, unpack it and there is folder bootloader with waf file inside it – wallycz Feb 16 '16 at 12:38
  • thank you wallycz that was helpfull now I am able to run my test program. but my main program which contains RPI.GPIO, Tkinter,mysql,PIL is not running.at the 1st line my python command was import RPi.GPIO as GPIO the error is : Import error : No module named RPi.GPIO – Akash Nil Feb 17 '16 at 07:05
  • Have you installed RPI.GPIO library for Python3? `sudo pip install RPi.GPIO` and then again `sudo pyinstaller ./test.py`. It works for me... – wallycz Feb 17 '16 at 15:36