pillow安装失败问题

在使用pip install pillow命令时,安装出错,提示如下:

 gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -Isrc/Tk -I/tmp/pip-install-xr8nqb_8/pillow/src/libImaging -I/tmp/pip-install-xr8nqb_8/pillow -I/usr/include -I/usr/include/python3.6m -c src/_imagingtk.c -o build/temp.linux-x86_64-3.6/src/_imagingtk.o
    src/_imagingtk.c:16:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    src/_imaging.c:74:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    building 'PIL._imagingmath' extension
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/tmp/pip-install-xr8nqb_8/pillow/src/libImaging -I/tmp/pip-install-xr8nqb_8/pillow -I/usr/include -I/usr/include/python3.6m -c src/_imagingmath.c -o build/temp.linux-x86_64-3.6/src/_imagingmath.o
    building 'PIL._imagingmorph' extension
    gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/tmp/pip-install-xr8nqb_8/pillow/src/libImaging -I/tmp/pip-install-xr8nqb_8/pillow -I/usr/include -I/usr/include/python3.6m -c src/_imagingmorph.c -o build/temp.linux-x86_64-3.6/src/_imagingmorph.o
    src/_imagingmath.c:16:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    src/_imagingmorph.c:14:20: fatal error: Python.h: No such file or directory
     #include "Python.h"
                        ^
    compilation terminated.
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-xr8nqb_8/pillow/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-0wrtmkzl/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-xr8nqb_8/pillow/
FATAL: Failed installing package pillow

找不到Python.h头文件,没有gcc之类的问题其实都是因为从Pillow 3.0.0.开始需要libjpeg 和 zlib两个包才能编译,现在下载的Pillow里没有这两个包,所以下载失败

换个指令下载就行:

pip install --upgrade pillow

文章出处登录后可见!

已经登录?立即刷新

共计人评分,平均

到目前为止还没有投票!成为第一位评论此文章。

(0)
心中带点小风骚的头像心中带点小风骚普通用户
上一篇 2022年5月17日
下一篇 2022年5月18日

相关推荐