Credit to danielfm
First you need to download the source code and change the package build for the Python package. Replace X
with the version you wish to install:
$ git clone -b openelec-X.0 https://github.com/openelec/openelec.tv
$ cd openelec.tv
$ vim packages/lang/Python/package.mk
Change vim
with whatever text editor you prefer. Then find the following line:
EXCLUDE_DIRS="bsddb curses idlelib lib-tk lib2to3 msilib pydoc_data test unittest distutils"
Remove distutils
and unittest
from this line and save your changes. If neither are present, then you don't have to recompile and may skip to the next section on how to install pip etc.
You can now compile it. THIS WILL TAKE A LONG TIME. Depending on your setup/hardware/etc, this will take at least a couple of hours. It took me 4 hours in a virtual machine with 2 GB ram, 1 core. Also make sure you have enough space. It took up ~15-20gb for me.
Run the following command to compile it for a raspberry pi (append image
at the end if you wish to create an image file):
$ PROJECT=RPi ARCH=arm make
If you wish to compile it for a different architecture then take a look at this guide.
Wait a gazillion hours while it compiles.
After it completes, either clone the image file onto an sd card or follow the rpi installation guide to install it. For other devices, use this guide instead.
Boot it up and ssh into it. NOTE: ~ usually just points to /storage
Create the file ~/.pydistutils.cfg
with the
following content:
[install]
install_lib = ~/lib
install_scripts = ~/bin
This file will let Python know where to install the packages.
Set PYTHONPATH
and PATH
variables in ~/.profile
for ease of use:
export PYTHONPATH=~/lib
export PATH=$PATH:~/bin
$ cd ~
$ mkdir lib bin
$ curl -o get-pip.py https://raw.github.com/pypa/pip/master/contrib/get-pip.py
$ source .profile
$ python get-pip.py
If you did not include unittest
, then you need easy_install
and another unit test library. pyunit
will do the trick. If you already have the unittest
module, then skip the next part and simply install flexget
.
$ curl -o ez_setup.py https://bootstrap.pypa.io/ez_setup.py
$ python ez_setup.py
$ easy_install pyunit
Flexget can now be installed and whatever other libraries you need.
$ pip install flexget
END OF TEXT
Or you can use -L to follow redirects
$ curl -L -o get-pip.py https://raw.github.com/pypa/pip/master/contrib/get-pip.py