Ubuntu 11.04:使用PIP将PIL安装到virtualenv中 [英] Ubuntu 11.04: Installing PIL into a virtualenv with PIP
问题描述
我已经花了几个小时试图解决这个问题.
I have spent hours now trying to figure this out.
我执行以下操作:
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
每当我尝试在django-cms网站上上传图像时,都会收到错误消息.
Whenever I try to upload an image in my django-cms website I get an error message.
推荐答案
我在尝试使用Django&时遇到了相同的问题Virtualenv-我无法上传图像,经过一番研究,所有内容都指向PIL.我确实尝试过重新安装该软件包,但是即使上传了所有必需的库,PIL仍然不支持JPG和PNG.
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).
我的解决方案:
-
确保已安装所有库.
Make sure you have all the libraries installed.
sudo apt-get install libjpeg-dev libjpeg62 libjpeg62-dev zlib1g-dev libfreetype6 libfreetype6-dev
安装Pillow,这是PIL的较精巧软件包.
Install Pillow, which is a saner package of PIL.
pip安装枕头(在您的virtualenv中)
pip install pillow (while in your virtualenv)
这篇关于Ubuntu 11.04:使用PIP将PIL安装到virtualenv中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!