Python3 PIL Pillow Ubuntu Install

18,641

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.

Share:
18,641

Related videos on Youtube

fish
Author by

fish

Updated on June 04, 2022

Comments

  • fish
    fish almost 2 years

    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.

  • fish
    fish almost 10 years
    So I tried sudo apt-get install python3-pil and it said I already had that installed. Afterwards I tried the export line which executed on command line without any output. That still did not fix the python code. In the code I should be importing from PIL still right? Additionally, I am a little confused by your pip --user comment. Do you mean I shouldn't do sudo pip? I'm just confused because pip apparently doesn't have a --user arg.
  • fish
    fish almost 10 years
    Ah. I finally figure it out! Thanks so much!