I want to install PIL and python-numpy at the least. I want to turn an image into an array but really can't seem to find info on installing/using modules to raspberry pi. Could somebody just explain?
2 Answers
Assuming that you are using the Raspberry Pi Foundation's recommended Raspbian image, those packages are available through the package manager. For numpy, you want to run this as root, using sudo if appropriate:
apt-get install python-numpy
Installing PIL is similar; just find the package name for PIL and apt-get it. I don't know it myself, but using "apt-cache search " and grep will find it for you fairly quickly.
-
so then saying "import PIL as image" and "import python-numpy as numpy" should allow me to use them? or do I need to fiddle with environment variables? Aug 24, 2013 at 23:53
-
Yes, you should be able to import them once installed. I have not looked up the actual python that does it, but those lines look good to me. Give it a try; python will let you know if anything is wrong.– mfabelAug 25, 2013 at 2:44
The numpy-version in the raspbian-repository is quite old. If you need a newer version, you should install it directly.
I used PIP:
sudo apt-get install python-pip
then (for numpy):
sudo pip install --upgrade numpy
Beware, this will take some time (hours)
-
This is how I was able to install numpy on my Raspberry Pi (gen. 1, model B). It took about 1.5 hours to for pip to finish.– ckbMar 30, 2015 at 0:30