- Python interpreter and libraries are not installed in the default APF rootfs:
- Currently it increases the rootfs size by 6 MBytes and so, without cleanup, it won't fit in the old APF9328 boards with 8 MBytes FLASH size. So for the moment, if you have an 8MB FLASH, you can only use it from a NFS or a MMC/SD rootfs. If your are a Python expert you can still delete some files in $ARMADEUS_ROOTFS/usr/lib/python2.7/... and tell us what isn't mandatory and uses a lot of space for nothing.
- On the APF27/51/28/6, you can activate it without concerning about the FLASH size.
- Python version available in latest Buildroot is 2.7.
- Launch Buildroot's menuconfig:
$ make menuconfig
Target packages ---> Interpreter languages and scripting ---> [*] python python module format to install (.pyc compiled sources only) ---> core python modules ---> external python modules --->
- then save your configuration and rebuild your system:
- reflash you rootfs or, if needed, copy it to your NFS directory or on your MMC/SD: Booting from NFS or Booting from MMC/SD.
- First take your favorite editor/IDE and create the following script:
import sys print "APF says: Hello World ! ;-)" sys.exit(0)
- Save it as hello.py
Not needed. Transforming python script in executables hasn't been tested yet.
- Copy your hello.py script on your target through TFTP or NFS export dir or your MMC/SD
- then on your APF console, launch it:
# python hello.py APF says: Hello World ! ;-) #
Now it's up to you !! But keep in mind that Python is extremely powerful and libraries rich, so if you don't pay attention to memory usage of your scripts, you can easily reach the APF9328 RAM size limit: 16 MBytes. On the APF27/51/28/6, it will be much more difficult ;-).
Defaults python modules can be enabled/disabled by Buildroot menuconfig.
Default Python installation on Buildroot is "minimal"; for certain usage, it's necessary to install more modules. Here a list of modules tested on the APF9328 :
This module is used to communicate through serial port (RS232). The package is really simple to install:
$ make menuconfig
Target packages ---> Interpreter languages and scripting ---> [*] python ... external python modules ---> ... [*] python-serial
- To develop Graphical User Interface with Python you have the choice: