How to choose Pyinstaller Python compiler on Raspberry PI?

2,581 views
Skip to first unread message

Gianluca Storti

unread,
Sep 16, 2016, 6:57:58 AM9/16/16
to PyInstaller
Hi everyone, 
in the last days, I have finally finished my project and I started using PyInstaller, actually a great and easy tool for compiling python!

My project, that uses a Raspberry Pi 2 and Jessie OS, is composed of files for Python2.7 and files for Python3 and here is the problem:

First, I have successfully installed PyInstaller on my Raspberry using pip -> "sudo pip install pyinstaller", and after I compiled one of my files that uses Python2.7 using "sudo pyinstaller --onefile my_file.py". The result is great and everything worked.

Afterward, I have installer PyInstaller per Python3 using "sudo pip3 install pyinstaller", and I have compiled another file that uses Python3 using  "sudo pyinstaller --onefile my_file_for_python3.py". The result is great and everything worked.

HERE is the problem: if now I want to compile the first file that uses Python2.7, PyInstaller is not able to prperly do it because it will use always the Python3 compiler (I can see in the log).....it seems once you upgrade to the version of PyInstaller for python3, every file will be compiled using Python3 compiler without choice.

Is anyone able to guide me how to fix this problem? I searched in the PyInstaller manual but I was not able to find any option to specify the compiler on the command line

Thanks in advance

Hartmut Goebel

unread,
Sep 16, 2016, 7:22:46 AM9/16/16
to pyins...@googlegroups.com
Am 15.09.2016 um 19:50 schrieb Gianluca Storti:
Is anyone able to guide me how to fix this problem? I searched in the PyInstaller manual but I was not able to find any option to specify the compiler on the command line

Both pip and pip3 install the pyinstaller script into the same place (e.g. /usr/bin). There are two solutions

a) set up a virtual env for one (or for both) installations
b) do not *install* pyinstaller, but jsut download and unpack the archive. Then you can run it using either
python2 /path/to/pyinstaller/pyinstaller.py …
or
python3 /path/to/pyinstaller/pyinstaller.py …
HTH

--
Schönen Gruß
Hartmut Goebel
Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
Information Security Management, Security Governance, Secure Software Development

Goebel Consult, Landshut
http://www.goebel-consult.de

Blog: http://www.goebel-consult.de/blog/get-current-locale-with-ansible
Kolumne: http://www.cissp-gefluester.de/2010-08-scheingefechte-um-rim

Hartmut Goebel

unread,
Sep 16, 2016, 7:23:34 AM9/16/16
to pyins...@googlegroups.com
Am 16.09.2016 um 13:22 schrieb Hartmut Goebel:
b) do not *install* pyinstaller, but jsut download and unpack the archive. Then you can run it using either

Steve Barnes

unread,
Sep 16, 2016, 7:44:33 AM9/16/16
to pyins...@googlegroups.com


On 16/09/2016 12:22, Hartmut Goebel wrote:
> Am 15.09.2016 um 19:50 schrieb Gianluca Storti:
>> Is anyone able to guide me how to fix this problem? I searched in the
>> PyInstaller manual but I was not able to find any option to specify
>> the compiler on the command line
>
> Both pip and pip3 install the pyinstaller script into the same place
> (e.g. /usr/bin). There are two solutions
>
> a) set up a virtual env for one (or for both) installations
> b) do not *install* pyinstaller, but jsut download and unpack the
> archive. Then you can run it using either
>
> python2 /path/to/pyinstaller/pyinstaller.py …
>
> or
>
> python3 /path/to/pyinstaller/pyinstaller.py …
>
> HTH
>
> --
> Schönen Gruß
> Hartmut Goebel
> Dipl.-Informatiker (univ), CISSP, CSSLP, ISO 27001 Lead Implementer
> Information Security Management, Security Governance, Secure Software
> Development
>
> Goebel Consult, Landshut
> http://www.goebel-consult.de
>

A 3rd option is to have one SD card with Raspberian installed with
PyInstaller for Python 2 and another for Python 3, (SD cards are not
that expensive), or even a separate RaspberryPi for each.

--
Steve (Gadget) Barnes
Any opinions in this message are my personal opinions and do not reflect
those of my employer.
Reply all
Reply to author
Forward
0 new messages