Ubuntu 11.04: Installing PIL into a virtualenv with PIP [closed]

2024/11/8 1:40:02

I have spent hours now trying to figure this out.

I do the following:

sudo apt-get install python-dev
sudo apt-get install libjpeg8-dev
sudo apt-get install libfreetype6 libfreetype6-dev
mkvirtualenv -p python2.7 --no-site-packages foobar
pip install PIL

Whenever I try to upload an image in my django-cms website I get an error message.

Answer

I've ran into the same issue while trying to use Django & Virtualenv - I couldn't upload images and after some research everything pointed towards PIL. I did try to reinstall the package but even with all the required libraries uploaded PIL still wouldn't support JPGs and PNGs.

Seems that Ubuntu peeps decided to moved the location of the libraries around (according to this fix: http://ubuntuforums.org/showpost.php?p=10804763&postcount=2).

My solution:

  1. Make sure you have all the libraries installed.

    sudo apt-get install libjpeg-dev libjpeg62 libjpeg62-dev zlib1g-dev libfreetype6 libfreetype6-dev

  2. Install Pillow, which is a saner package of PIL.

    pip install pillow (while in your virtualenv)

https://en.xdnf.cn/q/120673.html

Related Q&A

What does this error mean ? Expected an indented block Python [duplicate]

This question already has answers here:Im getting an IndentationError (or a TabError). How do I fix it?(6 answers)Closed 7 months ago.My code is the following:def value(one,two): if one < two: retu…

Why is len(file.read()) giving me a value of zero?

Why are the values of print len() different for both functions? Are they not the same?The file this script is opening was a text file with three lines of text. i named it test.txt and inside it was J…

Re-formatting user input with spaces

Im using an input function where I want to convert any spaces in the input to +s. So for example, if the user inputs iphone 7 black, I want to convert this to iphone+7+black.

How to set a pdf background color? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.Want to improve this question? Add details and clarify the problem by editing this post.Closed 4 years ago.Improve…

Row Average CSV Python

Im looking for a piece of code that will print the average for each users score from a csv.It needs to read all scores and then work out an average across the row for each users.It also needs to calcul…

To input a file and get a formatted string output using .format()

Write a function named calculate_expenses that receives a filename as argument. The file contains the information about a persons expenses on items. Your function should return a list of tuples sorted …

How to use python regex to extract IP address from server log files?

I am currently getting started with python. I have a server log file for the pages I visited over a period of time. How do I write a python program to find out which IP address was visited most? Will …

DateFormatter returning wrong dates - Matplotlib/Pandas [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.Questions concerning problems with code youve written must describe the specific problem — and incl…

What does the error IndentationError: expected an indented block in python mean? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.This question was caused by a typo or a problem that can no longer be reproduced. While similar q…

How to insert character in csv cell in python?

Im new with python. Here is my csv file :data;data;name surname; data; data data;data;name surname; data; data data;data;name surname; data; data data;data;name surname; data; dataThe thing that I want…