无法让PIL在Ubuntu 12.04上正确安装 [英] Can't get PIL to correctly install on Ubuntu 12.04

查看:80
本文介绍了无法让PIL在Ubuntu 12.04上正确安装的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu 12.04,并且处于PIL-地狱状态.我已经尝试了所有可以在网上找到的有关安装PIL的建议,但是我没有运气.我知道事实上我有很多依赖.我已经尝试了所有的symlink方法.我已经修改了setup.py文件,以确保找到正确的目录.我也尝试过从源代码构建并通过pip安装.什么都行不通.这是我安装时得到的:

I'm using Ubuntu 12.04 and I'm in PIL-hell. I've tried every suggestion I can find online for ways to install PIL, but I have no luck. I know for a fact I have every dependency. I've tried all of the symlink methods. I've modified the setup.py file to ensure it finds the correct directories. I've also tried building from source and installing through pip. Nothing works. Here's what I get when I install:

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.3 (default, Nov  4 2012, 15:42:19)
          [GCC 4.4.3]
--------------------------------------------------------------------
*** TKINTER support not available
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------

这是selftest.py显示的内容:

Here's what selftest.py shows:

--------------------------------------------------------------------
PIL 1.1.7 TEST SUMMARY 
--------------------------------------------------------------------
Python modules loaded from ./PIL
Binary modules loaded from ./PIL
--------------------------------------------------------------------
--- PIL CORE support ok
*** TKINTER support not installed
*** JPEG support not installed
*** ZLIB (PNG/ZIP) support not installed
*** FREETYPE2 support not installed
*** LITTLECMS support not installed
--------------------------------------------------------------------

我不知道还有什么尝试.我只是想玩一些愚蠢的PNG文件...

I have no idea what else to try. I'm just trying to play with some stupid PNG files...

推荐答案

最简单的方法应为:

sudo apt-get install python-imaging

如果您需要安装在virtualenv中,或者想要绝对最新的版本,请使用pip.首先安装一些pil需要的东西,然后运行pip install:

if you need to install in a virtualenv, or want the absolute latest version use pip. First install some stuff pil needs, then run the pip install:

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

要回应以下评论.如果您全新安装ubuntu 12.04并运行apt-get install python-imaging,则将在系统上正确安装PIL.在运行selftest.py的ubuntu 12.04上,我得到以下输出:

To respond to the comment below. If you take a fresh installation of ubuntu 12.04 and run apt-get install python-imaging you will have PIL installed correctly on your system. on my ubuntu 12.04 box when I run selftest.py I get the following output:

--------------------------------------------------------------------
PIL 1.1.7 TEST SUMMARY 
--------------------------------------------------------------------
Python modules loaded from /usr/lib/python2.7/dist-packages/PIL
Binary modules loaded from /usr/lib/python2.7/dist-packages/PIL
--------------------------------------------------------------------
--- PIL CORE support ok
*** TKINTER support not installed
--- JPEG support ok
--- ZLIB (PNG/ZIP) support ok
--- FREETYPE2 support ok
--- LITTLECMS support ok
--------------------------------------------------------------------

您正在寻找的PNG支持显示正常.我怀疑您的python安装可能处于某种损坏状态.也许您提到的符号链接或其他尝试安装此软件包的尝试已损坏您的安装.我可以提供三种建议来纠正这种情况

PNG support which you are looking for shows as ok. I suspect that your python installation is probably in some sort of corrupt state. Maybe the symlinking you mentioned or other attempts at installing this package has corrupted your installation. There are three recommendations I can give for correcting this situation

解决方案

  1. 在计算机上重新安装ubuntu.绝对可以.
  2. 创建一个python virtualenv ,然后使用pip在此处安装PIL.这可能有效,具体取决于基本python系统的损坏程度.这里的想法是默认情况下virtualenv将创建一个新的python环境,其中仅包含标准库.
  3. 修复您的python安装.您可以尝试apt-get purge python-imaging,然后重新安装python-imaging软件包.
  1. re-install ubuntu on the machine. This should definitely work.
  2. create a python virtualenv and then install PIL there using pip. This might work depending on how corrupt the base python system is. The idea here is that virtualenv by default will create a new python environment that only has the standard library in it.
  3. repair your python installation. You could try apt-get purge python-imaging and then re-install the python-imaging package.

这篇关于无法让PIL在Ubuntu 12.04上正确安装的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆