Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python3 PIL Pillow Ubuntu Install

I'm running Ubuntu 14.04 LTS. I have both Python 2.7 and Python 3.4 installed. I'm relatively novice when it comes to installing Python Packages in Linux.

I'm just trying to install and get access to PIL's image library in Python 3.4. It is my understanding that this is achieved by installing Pillow, the modern fork of PIL.

It seems in my floundering I managed to successfully get PIL working in Python 2.7, but I still cannot get it working in 3.4.

I got pip and pip3. When I enter

sudo pip3 install Pillow

I get the following error message, implying it is is installed:

Requirement already satisfied (use --upgrade to upgrade): Pillow in /usr/local/lib/python3.4/dist-packages
Cleaning up...

Yet when I try to import either PIL or Pillow in Python 3.4, the module is not found.

I feel like I'm just missing something simple.

like image 437
fish Avatar asked May 29 '26 21:05

fish


1 Answers

Pillow is packaged as python3-pil in Ubuntu 14.04 (Trusty Tahr). You can install it system-wide with:

sudo apt-get install python3-pil

You seem to have already installed Pillow with pip earlier, but the default path it pip places it in is not read by the system Python. You can add it to the search path with:

export PYTHONPATH=/usr/local/lib/python3.4/dist-packages:/usr/local/lib/python3.4/site-packages

Generally you are better off using pip --user to avoid breaking the system installations or to stick with the packaged variants of base Python modules if possible.

like image 150
jtaylor Avatar answered May 31 '26 15:05

jtaylor



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!