在ubuntu 14.04上安装枕头

我对Pillow很生气。 我已经在这里问过,没有解决:

Pillow包的Python Django Mezzanine安装失败

我有Ubuntu 14.04和python 2.7。

使用pip或从github安装枕头我有这个错误:

x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/_imaging.o: File o directory non esistente x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/decode.o: File o directory non esistente x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/encode.o: File o directory non esistente x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/map.o: File o directory non esistente x86_64-linux-gnu-gcc: error: build/temp.linux-x86_64-2.7/display.o: File o directory non esistente 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_root/Pillow/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ctXrZt-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/Pillow Traceback (most recent call last): File "/usr/bin/pip", line 9, in  load_entry_point('pip==1.5.4', 'console_scripts', 'pip')() File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 185, in main return command.main(cmd_args) File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main text = '\n'.join(complete_log) UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 28: ordinal not in range(128) 

当然,我也遵循这个:

PIL安装在Ubuntu 14.04.1 LTS中

也许有一些图书馆冲突。 我尝试删除所有并再次安装但我总是有同样的错误。

你有建议吗?

首先,你需要python-dev包,因为Pillow需要定义编译头。

 sudo apt-get install python-dev 

在Ubuntu 14.04上,你需要很少的额外包才能让枕头正常工作。 使用以下命令安装所有这些:

 sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk 

这适用于python 2.x和python 3.x. 您可能不需要所有这些,但至少应该安装libjpeg8-devzlib1g-dev以支持JPEG和PNG。

如果您使用的是Ubuntu 12.04,请使用以下命令。

 sudo apt-get install libtiff4-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.5-dev tk8.5-dev python-tk 

详细说明可在官方枕头文档中找到。

安装 – 枕头(PIL Fork)2.6.1文档

 sudo apt-get install python-dev python-setuptools 

 sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev liblcms2-dev libwebp-dev tcl8.6-dev tk8.6-dev python-tk 

尝试安装此开发依赖项:

 sudo apt-get install python-dev python-setuptools 

除了上述安装之外,我仍然在安装Pillow时出现上述错误。

要修复错误,请导航到/ usr / include:

 cd /usr/include 

创建一个指向freetype2目录的符号链接:

 ln -s freetype2 freetype