PIP安装PIL python2.7 ubuntu 14.04.1

时间:2015-01-20 11:32:41

标签: python ubuntu pip python-imaging-library

我正在尝试安装PIP以运行较旧的应用程序,并且已经遵循了许多步骤,最后的障碍是安装PIP。原因是我正在尝试使用的功能显示此错误:

ImportError: No module named PIL

我按照http://prateekvjoshi.com/2014/04/19/how-to-install-pil-on-ubuntu/

的说明进行操作

并且必须稍微改变命令:

sudo pip install PIL - 允许外部PIL - 允许未经验证的PIL

我遇到了一些错误,不知道如何解决这些错误:

任何人都可以分享任何想法吗?我确定它只是一个图书馆或遗失的东西?

由于

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1197, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1375, in unpack_url
    self.session,
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 582, in unpack_http_url
    unpack_file(temp_location, location, content_type, link)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 625, in unpack_file
    untar_file(filename, location)
  File "/usr/lib/python2.7/dist-packages/pip/util.py", line 543, in untar_file
    tar = tarfile.open(filename, mode)
  File "/usr/lib/python2.7/tarfile.py", line 1678, in open
    return func(name, filemode, fileobj, **kwargs)
  File "/usr/lib/python2.7/tarfile.py", line 1727, in gzopen
    **kwargs)
  File "/usr/lib/python2.7/tarfile.py", line 1705, in taropen
    return cls(name, mode, fileobj, **kwargs)
  File "/usr/lib/python2.7/tarfile.py", line 1574, in __init__
    self.firstmember = self.next()
  File "/usr/lib/python2.7/tarfile.py", line 2335, in next
    raise ReadError(str(e))
ReadError: invalid header

Storing debug log for failure in /home/peek/.pip/pip.log

2 个答案:

答案 0 :(得分:1)

也许你可以再次检查一下你的计算机有多少位?

install PIL on 64-bit Ubuntu 12.04

这个怎么样? https://askubuntu.com/questions/507459/pil-install-in-ubuntu-14-04-1-lts

$ sudo apt-get build-dep python-imaging
$ sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
$ sudo pip install Pillow

用于Python上的检查版本

>>> import PIL
>>> PIL.VERSION
'1.1.7'

答案 1 :(得分:0)

我现在安装了PIL(显然)....但我似乎无法通过python导入模块:

--------------------------------------------------------------------
PIL 1.1.7 SETUP SUMMARY
--------------------------------------------------------------------
version       1.1.7
platform      linux2 2.7.6 (default, Mar 22 2014, 22:59:56)
              [GCC 4.8.2]
--------------------------------------------------------------------
*** TKINTER support not available (Tcl/Tk 8.6 libraries needed)
--- JPEG support available
--- ZLIB (PNG/ZIP) support available
--- FREETYPE2 support available
*** LITTLECMS support not available
--------------------------------------------------------------------
To add a missing option, make sure you have the required
library, and set the corresponding ROOT variable in the
setup.py script.

To check the build, run the selftest.py script.
changing mode of build/scripts-2.7/pilfile.py from 644 to 755
changing mode of build/scripts-2.7/pilfont.py from 644 to 755
changing mode of build/scripts-2.7/pilconvert.py from 644 to 755
changing mode of build/scripts-2.7/pilprint.py from 644 to 755
changing mode of build/scripts-2.7/pildriver.py from 644 to 755

changing mode of /usr/local/bin/pilfile.py to 755
changing mode of /usr/local/bin/pilfont.py to 755
changing mode of /usr/local/bin/pilconvert.py to 755
changing mode of /usr/local/bin/pilprint.py to 755
changing mode of /usr/local/bin/pildriver.py to 755
Successfully installed PIL
Cleaning up...
peek@peeklinux:~$ 

我怎么运行

peek@peeklinux:~$ python
Python 2.7.5 (default, Jan 19 2015, 21:02:01) 
[GCC 4.8.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import PIL
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PIL

我收到导入错误问题。有什么想法吗?

再次感谢您的耐心等待:)