【问题标题】:Install PIL works for sudo, can't use in venv安装 PIL 适用于 sudo,不能在 venv 中使用
【发布时间】:2012-12-20 06:23:36
【问题描述】:

我在 Ubuntu 10.04 中工作。我机器上的默认python是2.6。我用 python 2.7 创建了一个virutalenv。我正在编写一个要在 googleappengine 上运行的 django 应用程序。为了在我的一个模型中使用 ImageField,我需要安装 PIL。有很多很多关于安装 PIL 的帖子,我关注了其中很多都没有成功。

我可以成功运行

sudo pip install PIL

但我的 virtualenv 无法访问它。当我跑步时

pip install PIL

在我的 virtualenv 中,我得到一个 gcc 错误。

我安装了所有依赖项,apt-get 安装了 python-imaging,下载了 PIL 并尝试使用 setup.py 构建/安装,并按照我阅读的许多帖子中的许多其他说明进行操作。

有人有什么想法吗?

编辑:

错误:

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

编辑:我可以粘贴尽可能多的错误(其余的不在屏幕上)

 _imaging.c:301: error: ‘PyExc_IOError’ undeclared (first use in this function)

_imaging.c:302: error: ‘NULL’ undeclared (first use in this function)

_imaging.c: In function ‘ImagingError_MemoryError’:

_imaging.c:308: warning: implicit declaration of function ‘PyErr_NoMemory’

_imaging.c:308: warning: return makes pointer from integer without a cast

_imaging.c: In function ‘ImagingError_Mismatch’:

_imaging.c:314: error: ‘PyExc_ValueError’ undeclared (first use in this function)

_imaging.c:315: error: ‘NULL’ undeclared (first use in this function)

_imaging.c: In function ‘ImagingError_ModeError’:

_imaging.c:321: error: ‘PyExc_ValueError’ undeclared (first use in this function)

_imaging.c:322: error: ‘NULL’ undeclared (first use in this function)

_imaging.c: In function ‘ImagingError_ValueError’:

_imaging.c:329: error: ‘PyExc_ValueError’ undeclared (first use in this function)

_imaging.c:332: error: ‘NULL’ undeclared (first use in this function)

_imaging.c: In function ‘ImagingError_Clear’:

_imaging.c:338: warning: implicit declaration of function ‘PyErr_Clear’

_imaging.c: At top level:

_imaging.c:369: error: expected ‘)’ before ‘*’ token

_imaging.c:464: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:510: error: expected ‘)’ before ‘*’ token

_imaging.c:587: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:619: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:631: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:643: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:655: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:664: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:675: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:686: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:697: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:719: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:743: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:760: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:777: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:786: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:803: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:813: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:824: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:857: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:879: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:914: error: expected ‘)’ before ‘*’ token

_imaging.c:954: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:981: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1054: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1065: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1075: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1114: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1191: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1202: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1339: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1359: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1394: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1419: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1448: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1459: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1479: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1530: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1568: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1614: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1689: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1739: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1765: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1771: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1783: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1817: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1845: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1874: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1885: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1901: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1922: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1928: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1939: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1950: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1961: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1972: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:1983: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2001: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2019: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2030: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2041: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2052: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2063: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2081: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c: In function ‘_font_dealloc’:

_imaging.c:2142: warning: implicit declaration of function ‘Py_XDECREF’

_imaging.c:2142: error: ‘ImagingFontObject’ has no member named ‘ref’

_imaging.c: In function ‘textwidth’:

_imaging.c:2152: error: ‘ImagingFontObject’ has no member named ‘glyphs’

_imaging.c: At top level:

_imaging.c:2157: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2205: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2215: error: array type has incomplete element type

_imaging.c:2216: error: ‘PyCFunction’ undeclared here (not in a function)

_imaging.c:2216: error: expected ‘}’ before ‘_font_getmask’

_imaging.c:2217: error: expected ‘}’ before ‘_font_getsize’

_imaging.c:2218: error: ‘NULL’ undeclared here (not in a function)

_imaging.c:2221: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2229: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c: In function ‘_draw_dealloc’:

_imaging.c:2257: error: ‘ImagingDrawObject’ has no member named ‘image’

_imaging.c: At top level:

_imaging.c:2261: error: expected ‘)’ before ‘*’ token

_imaging.c:2263: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2278: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2298: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2335: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2353: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2390: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2406: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2459: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2474: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2507: error: expected ‘)’ before ‘*’ token

_imaging.c:2509: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2536: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2554: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2600: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2637: error: array type has incomplete element type

_imaging.c:2640: error: expected ‘}’ before ‘_draw_line’

_imaging.c:2641: error: expected ‘}’ before ‘_draw_lines’

_imaging.c:2643: error: expected ‘}’ before ‘_draw_outline’

_imaging.c:2645: error: expected ‘}’ before ‘_draw_polygon’

_imaging.c:2646: error: expected ‘}’ before ‘_draw_rectangle’

_imaging.c:2647: error: expected ‘}’ before ‘_draw_point’

_imaging.c:2648: error: expected ‘}’ before ‘_draw_points’

_imaging.c:2649: error: expected ‘}’ before ‘_draw_arc’

_imaging.c:2650: error: expected ‘}’ before ‘_draw_bitmap’

_imaging.c:2651: error: expected ‘}’ before ‘_draw_chord’

_imaging.c:2652: error: expected ‘}’ before ‘_draw_ellipse’

_imaging.c:2653: error: expected ‘}’ before ‘_draw_pieslice’

_imaging.c:2654: error: expected ‘}’ before ‘_draw_ink’

_imaging.c:2659: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2668: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c: In function ‘pixel_access_dealloc’:

_imaging.c:2693: error: ‘PixelAccessObject’ has no member named ‘image’

_imaging.c: At top level:

_imaging.c:2697: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2708: error: expected declaration specifiers or ‘...’ before ‘PyObject’

_imaging.c:2708: error: expected declaration specifiers or ‘...’ before ‘PyObject’

_imaging.c: In function ‘pixel_access_setitem’:

_imaging.c:2710: error: ‘PixelAccessObject’ has no member named ‘image’

_imaging.c:2714: error: ‘PixelAccessObject’ has no member named ‘readonly’

_imaging.c:2719: warning: implicit declaration of function ‘_getxy’

_imaging.c:2719: error: ‘xy’ undeclared (first use in this function)

_imaging.c:2723: error: ‘PyExc_IndexError’ undeclared (first use in this function)

_imaging.c:2727: error: ‘color’ undeclared (first use in this function)

_imaging.c:2730: warning: implicit declaration of function ‘getink’

_imaging.c:2733: error: ‘PixelAccessObject’ has no member named ‘image’

_imaging.c: At top level:

_imaging.c:2744: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2763: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2774: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2791: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2811: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2846: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:2867: error: array type has incomplete element type

_imaging.c:2870: error: expected ‘}’ before ‘_getpixel’

_imaging.c:2871: error: expected ‘}’ before ‘_putpixel’

_imaging.c:2873: error: expected ‘}’ before ‘pixel_access_new’

_imaging.c:2876: error: expected ‘}’ before ‘_convert’

_imaging.c:2877: error: expected ‘}’ before ‘_convert2’

_imaging.c:2878: error: expected ‘}’ before ‘_convert_matrix’

_imaging.c:2879: error: expected ‘}’ before ‘_copy’

_imaging.c:2880: error: expected ‘}’ before ‘_copy2’

_imaging.c:2884: error: expected ‘}’ before ‘_crop’

_imaging.c:2885: error: expected ‘}’ before ‘_expand’

_imaging.c:2886: error: expected ‘}’ before ‘_filter’

_imaging.c:2887: error: expected ‘}’ before ‘_histogram’

_imaging.c:2889: error: expected ‘}’ before ‘_modefilter’

_imaging.c:2891: error: expected ‘}’ before ‘_offset’

_imaging.c:2892: error: expected ‘}’ before ‘_paste’

_imaging.c:2893: error: expected ‘}’ before ‘_point’

_imaging.c:2894: error: expected ‘}’ before ‘_point_transform’

_imaging.c:2895: error: expected ‘}’ before ‘_putdata’

_imaging.c:2897: error: expected ‘}’ before ‘_quantize’

_imaging.c:2900: error: expected ‘}’ before ‘_rankfilter’

_imaging.c:2902: error: expected ‘}’ before ‘_resize’

_imaging.c:2903: error: expected ‘}’ before ‘_rotate’

_imaging.c:2904: error: expected ‘}’ before ‘_stretch’

_imaging.c:2905: error: expected ‘}’ before ‘_transpose’

_imaging.c:2906: error: expected ‘}’ before ‘_transform2’

_imaging.c:2908: error: expected ‘}’ before ‘_isblock’

_imaging.c:2910: error: expected ‘}’ before ‘_getbbox’

_imaging.c:2911: error: expected ‘}’ before ‘_getcolors’

_imaging.c:2912: error: expected ‘}’ before ‘_getextrema’

_imaging.c:2913: error: expected ‘}’ before ‘_getprojection’

_imaging.c:2915: error: expected ‘}’ before ‘_getband’

_imaging.c:2916: error: expected ‘}’ before ‘_putband’

_imaging.c:2917: error: expected ‘}’ before ‘_fillband’

_imaging.c:2919: error: expected ‘}’ before ‘im_setmode’

_imaging.c:2921: error: expected ‘}’ before ‘_getpalette’

_imaging.c:2922: error: expected ‘}’ before ‘_putpalette’

_imaging.c:2923: error: expected ‘}’ before ‘_putpalettealpha’

_imaging.c:2927: error: expected ‘}’ before ‘_chop_invert’

_imaging.c:2928: error: expected ‘}’ before ‘_chop_lighter’

_imaging.c:2929: error: expected ‘}’ before ‘_chop_darker’

_imaging.c:2930: error: expected ‘}’ before ‘_chop_difference’

_imaging.c:2931: error: expected ‘}’ before ‘_chop_multiply’

_imaging.c:2932: error: expected ‘}’ before ‘_chop_screen’

_imaging.c:2933: error: expected ‘}’ before ‘_chop_add’

_imaging.c:2934: error: expected ‘}’ before ‘_chop_subtract’

_imaging.c:2935: error: expected ‘}’ before ‘_chop_add_modulo’

_imaging.c:2936: error: expected ‘}’ before ‘_chop_subtract_modulo’

_imaging.c:2937: error: expected ‘}’ before ‘_chop_and’

_imaging.c:2938: error: expected ‘}’ before ‘_chop_or’

_imaging.c:2939: error: expected ‘}’ before ‘_chop_xor’

_imaging.c:2944: error: expected ‘}’ before ‘_gaussian_blur’

_imaging.c:2945: error: expected ‘}’ before ‘_unsharp_mask’

_imaging.c:2950: error: expected ‘}’ before ‘_effect_spread’

_imaging.c:2954: error: expected ‘}’ before ‘_new_array’

_imaging.c:2955: error: expected ‘}’ before ‘_new_block’

_imaging.c:2958: error: expected ‘}’ before ‘_save_ppm’

_imaging.c:2967: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c: In function ‘image_length’:

_imaging.c:2996: error: ‘ImagingObject’ has no member named ‘image’

_imaging.c: At top level:

_imaging.c:3001: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3016: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘image_as_sequence’

_imaging.c:3029: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘PyTypeObject’

_imaging.c:3050: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘PyTypeObject’

_imaging.c:3062: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘PyTypeObject’

_imaging.c:3076: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘pixel_access_as_mapping’

_imaging.c:3084: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘PyTypeObject’

_imaging.c:3106: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3107: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3108: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3109: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3110: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3111: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3112: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3113: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3114: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3115: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3116: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3117: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3118: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3119: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3120: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3123: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3124: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3125: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3126: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3127: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3128: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3129: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3144: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3147: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3149: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3150: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘*’ token

_imaging.c:3152: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘attribute’ before ‘functions’

_imaging.c:3250: warning: return type defaults to ‘int’

_imaging.c: In function ‘DL_EXPORT’:

_imaging.c:3250: error: expected declaration specifiers before ‘init_imaging’

_imaging.c:3281: error: expected ‘{’ at end of input

error: command 'gcc' failed with exit status 1

【问题讨论】:

  • “在我的 virtualenv 中,我收到了 gcc 错误。” - 究竟是哪个错误?
  • Burhan Khalid 所说的是正确的。您可能还想看看this SO post,因为这是我遇到过几次的问题。
  • 你是如何安装 Python2.7 的?似乎系统找不到 Python 构建标头。
  • 你需要弄清楚 Python 头文件在哪里,如果你是从一些 .deb 安装的,那么你将不得不手动下载源代码。
  • 你能指出我正确的方向吗?我必须下载哪个源? Python 2.7?

标签: python python-imaging-library ubuntu-10.04


【解决方案1】:

Pillow 可能会给您带来更好的运气。 Pillow 是 PIL 的一个分支,它解决了 PIL 的 setuptools 不兼容问题。

【讨论】:

  • 感谢您的宝贵时间。我已经尝试过了 - 但遇到了类似的错误。
【解决方案2】:

要在虚拟环境中安装 PIL,首先您需要确保所有依赖项在您的系统上都可用。

首先,确保您的构建环境已安装。运行sudo apt-get install build-essential,然后运行这个命令:

sudo apt-get build-dep python-imaging

完成后(可能需要一些时间),不使用 sudo 激活你的虚拟环境,然后不使用 sudo 在你的虚拟环境中运行 pip install PIL .

当您执行 sudo pip install PIL 时,它将它安装在系统范围的 Python 中,而不是在您的虚拟环境中。

【讨论】:

  • 我做了 sudo apt-get build-dep python-imaging。我确实花时间,但成功了。但是,当我运行 pip install PIL 时,我仍然遇到同样的错误!
  • 粘贴完整的错误,上面和下面的所有行。你已经安装build-essential了吗?
  • 是的,build-essential 已安装。
  • 我怎样才能“帮助”它找到 python 头文件?
【解决方案3】:

This is the guide我在新机器上安装时使用:

所需的依赖项:

  • libjpeg8
  • libjpeg8-dev
  • libfreetype6
  • libfreetype6-dev
  • zlib1g
  • zlib1g-dev

并仔细检查符号链接

HTH

【讨论】:

  • 感谢您的宝贵时间。这是一个有价值的指南,虽然它没有回答我的问题。
【解决方案4】:

感谢 Burhan Khalid 的指点,他们在路上送我。

我需要做的是

sudo apt-get install python2.7-dev.

这会将 Python.h 添加到 usr/include/python2.7,然后 gcc 就能够编译 PIL。

谢谢!

【讨论】:

    猜你喜欢
    • 2020-10-27
    • 1970-01-01
    • 2013-10-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-03-30
    • 1970-01-01
    • 2020-09-07
    相关资源
    最近更新 更多