【问题标题】:Can't install PIL on amazon ec2无法在亚马逊 ec2 上安装 PIL
【发布时间】:2012-07-20 21:41:54
【问题描述】:

我正在尝试在我的亚马逊实例上“pip install PIL”,但我不断收到此错误,有什么建议吗?

下载/解压 PIL 为包 PIL 运行 setup.py egg_info

警告:'' 不是一个有效的包名;请在 setup.py 中仅使用.-分隔的包名 安装收集的包:PIL

为 PIL 运行 setup.py install

WARNING: '' not a valid package name; please use only.-separated package names in setup.py
building '_imaging' extension
gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -DHAVE_LIBZ -IlibImaging -I/home/ec2-user/food-chute/foodchute/venv/include -I/usr/local/include -I/usr/include -I/usr/include/python2.6 -c _imaging.c -o build/temp.linux-x86_64-2.6/_imaging.o
_imaging.c:75:20: error: Python.h: No such file or directory
In file included from libImaging/Imaging.h:14,
                 from _imaging.c:77:
libImaging/ImPlatform.h:14:2: error: #error Sorry, this library requires support for ANSI prototypes.
libImaging/ImPlatform.h:17:2: error: #error Sorry, this library requires ANSI header files.
libImaging/ImPlatform.h:55:2: error: #error Cannot find required 32-bit integer type
In file included from _imaging.c:77:
libImaging/Imaging.h:90: error: expected specifier-qualifier-list before ‘INT32’
libImaging/Imaging.h:264: error: expected specifier-qualifier-list before ‘INT32’
libImaging/Imaging.h:395: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘ImagingCRC32’
_imaging.c:124: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_imaging.c:129: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
_imaging.c:143: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_imaging.c:151: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
_imaging.c:154: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_imaging.c:160: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
_imaging.c:165: error: expected specifier-qualifier-list before ‘PyObject_HEAD’
_imaging.c:170: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘PyTypeObject’
_imaging.c:172: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘*’ token
_imaging.c: In function ‘_dealloc’:
_imaging.c:204: error: ‘ImagingObject’ has no member named ‘access’

错误:命令“gcc”失败,退出状态为 1

【问题讨论】:

    标签: gcc amazon-ec2 python-imaging-library


    【解决方案1】:

    发生这种情况的原因是因为 ec2 默认具有 gcc 版本 4.4.6,它无法编译 Python 映像库。但是,如果您访问 ec2 网站,则可以通过执行以下操作来解决此问题

    While GCC 4.4.6 remains the default, we have included GCC 4.6.2, specifically for use on EC2 instances that support AVX. Run yum install gcc46 in order to get the packages. GCC 4.6 enables the Amazon Linux AMI to take advantage of the AVX support available on cc2.8xlarge instance types.

    来源:http://aws.amazon.com/amazon-linux-ami/2012.03-release-notes/

    【讨论】:

      【解决方案2】:

      对我来说,这个问题的解决方案实际上只是安装 python-devel

      【讨论】:

        猜你喜欢
        • 2013-03-03
        • 1970-01-01
        • 2023-03-26
        • 2017-07-19
        • 1970-01-01
        • 2021-09-19
        • 2016-12-22
        • 2016-12-07
        • 1970-01-01
        相关资源
        最近更新 更多