首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Ubuntu 14.04.1 LTS中的PIL安装

Ubuntu 14.04.1 LTS中的PIL安装
EN

Ask Ubuntu用户
提问于 2014-08-06 05:34:37
回答 2查看 32.9K关注 0票数 6

遵循如何安装python映像库(PIL)?为预设置库在Ubuntu14.04上安装PIL的步骤。但是,当我运行pip install PIL --allow-external PIL --allow-unverified PIL时,会看到以下错误:

代码语言:javascript
复制
building '_imagingft' extension

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/freetype2 -IlibImaging -I/usr/include -I/usr/include/tcl8.6 -I/usr/local/include -I/usr/include/python2.7 -c _imagingft.c -o build/temp.linux-x86_64-2.7/_imagingft.o

_imagingft.c:73:31: fatal error: freetype/fterrors.h: No such file or directory

 #include <freetype/fterrors.h>

                               ^

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_ubuntu/PIL/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3ckD6N-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_ubuntu/PIL
Traceback (most recent call last):
  File "/usr/local/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/usr/local/lib/python2.7/dist-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 57: ordinal not in range(128)
EN

回答 2

Ask Ubuntu用户

发布于 2014-09-24 13:48:44

我已经使用以下命令成功地安装了PIL:

代码语言:javascript
复制
sudo apt-get build-dep python-imaging
sudo apt-get install libjpeg8 libjpeg62-dev libfreetype6 libfreetype6-dev
sudo pip install Pillow

在这些命令之后,我可以:

代码语言:javascript
复制
>>> import PIL
>>> PIL.VERSION
'1.1.7'
票数 15
EN

Ask Ubuntu用户

发布于 2014-11-27 14:31:41

我也犯了同样的错误,试图安装Pillow 2.0.0。我找到了解决方案这里.(https://github.com/collective/buildout.python/issues/39)

简而言之,自由类型库的位置是在14.04移动的。一个权宜之计,如果麻烦的话,是建立一个符号链接。在我的系统中,库位于/usr而不是/usr/local中,所以我这样做了:

代码语言:javascript
复制
ln -s /usr/include/freetype2 /usr/include/freetype

在这样做之后,我意识到我可以通过将Pillow更新到>=2.6.0来解决这个问题。但是在任何情况下,您的问题是安装PIL,所以symlink的修复可能是一个很好的解决方案。

票数 3
EN
页面原文内容由Ask Ubuntu提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://askubuntu.com/questions/507459

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档