Monday, 12 June 2017

Python untuk Pengembangan IoT

Status : Draft

Referensi


  1. Zerynth,  middleware for smart devices, IoT and Industry 4.0 applications, https://www.zerynth.com/

Wednesday, 7 June 2017

PySide : Instalasi

Status : Draft

Ketika melakukan instalasi via pip ( sudo pip install PySide), saya mendapatkan error seperti berikut :

    /usr/bin/ld: /usr/local/lib/python2.7.9/lib/libpython2.7.a(abstract.o): relocation R_X86_64_32S against `_Py_NotImplementedStruct' can not be used when making a shared object; recompile with -fPIC
    /usr/local/lib/python2.7.9/lib/libpython2.7.a: error adding symbols: Bad value
    collect2: error: ld returned 1 exit status
    libshiboken/CMakeFiles/libshiboken.dir/build.make:381: recipe for target 'libshiboken/libshiboken-python2.7.so.1.2.4' failed
    make[2]: *** [libshiboken/libshiboken-python2.7.so.1.2.4] Error 1
    CMakeFiles/Makefile2:204: recipe for target 'libshiboken/CMakeFiles/libshiboken.dir/all' failed
    make[1]: *** [libshiboken/CMakeFiles/libshiboken.dir/all] Error 2
    Makefile:127: recipe for target 'all' failed
    make: *** [all] Error 2
    error: Error compiling shiboken
 

Ternyata hal ini terjadi karena python yang digunakan di Ubuntu, dikompilasi tanpa opsi --enable-shared, oleh karena itu kita perlu melakukan kompilasi ulang python.

sudo wget http://www.python.org/ftp/python/2.7.9/Python-2.7.9.tgz
sudo tar -xvvzf Python-2.7.9.tgz
cd Python-2.7.9/
sudo ./configure --enable-shared --prefix=/opt/python   LDFLAGS=-Wl,-rpath=/opt/python/lib
sudo make
sudo make install
sudo update-alternatives --install /usr/bin/python python /opt/python/bin/python 1
sudo update-alternatives --config python

Install pip :

wget -c https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
sudo pip install PySide