2012-10-16 53 views
0

我試圖通過運行使用MinGW

pip install pil 

我已經把我的編譯器MinGW的彙編關於Windows 7的64位 Python圖像庫編譯Python圖像庫。它看起來很好,直到編譯_imaging.c。它未能對這個怪物海合會呼籲:

C:\MinGW\bin\gcc.exe -shared -s build\temp.win-amd64-2.7\Release\_imaging.o build\temp.win-amd64-2.7\Release\decode.o build\temp.win-amd64-2.7\Release\encode.o build\temp.win-amd64-2.7\Release\map.o build\temp.win-amd64-2.7\Release\display.o build\temp.win-amd64-2.7\Release\outline.o build\temp.win-amd64-2.7\Release\path.o build\temp.win-amd64-2.7\Release\libimaging\access.o build\temp.win-amd64-2.7\Release\libimaging\antialias.o build\temp.win-amd64-2.7\Release\libimaging\bands.o build\temp.win-amd64-2.7\Release\libimaging\bitdecode.o build\temp.win-amd64-2.7\Release\libimaging\blend.o build\temp.win-amd64-2.7\Release\libimaging\chops.o build\temp.win-amd64-2.7\Release\libimaging\convert.o build\temp.win-amd64-2.7\Release\libimaging\convertycbcr.o build\temp.win-amd64-2.7\Release\libimaging\copy.o build\temp.win-amd64-2.7\Release\libimaging\crc32.o build\temp.win-amd64-2.7\Release\libimaging\crop.o build\temp.win-amd64-2.7\Release\libimaging\dib.o build\temp.win-amd64-2.7\Release\libimaging\draw.o build\temp.win-amd64-2.7\Release\libimaging\effects.o build\temp.win-amd64-2.7\Release\libimaging\epsencode.o build\temp.win-amd64-2.7\Release\libimaging\file.o build\temp.win-amd64-2.7\Release\libimaging\fill.o build\temp.win-amd64-2.7\Release\libimaging\filter.o build\temp.win-amd64-2.7\Release\libimaging\flidecode.o build\temp.win-amd64-2.7\Release\libimaging\geometry.o build\temp.win-amd64-2.7\Release\libimaging\getbbox.o build\temp.win-amd64-2.7\Release\libimaging\gifdecode.o build\temp.win-amd64-2.7\Release\libimaging\gifencode.o build\temp.win-amd64-2.7\Release\libimaging\hexdecode.o build\temp.win-amd64-2.7\Release\libimaging\histo.o build\temp.win-amd64-2.7\Release\libimaging\jpegdecode.o build\temp.win-amd64-2.7\Release\libimaging\jpegencode.o build\temp.win-amd64-2.7\Release\libimaging\lzwdecode.o build\temp.win-amd64-2.7\Release\libimaging\matrix.o build\temp.win-amd64-2.7\Release\libimaging\modefilter.o build\temp.win-amd64-2.7\Release\libimaging\mspdecode.o build\temp.win-amd64-2.7\Release\libimaging\negative.o build\temp.win-amd64-2.7\Release\libimaging\offset.o build\temp.win-amd64-2.7\Release\libimaging\pack.o build\temp.win-amd64-2.7\Release\libimaging\packdecode.o build\temp.win-amd64-2.7\Release\libimaging\palette.o build\temp.win-amd64-2.7\Release\libimaging\paste.o build\temp.win-amd64-2.7\Release\libimaging\quant.o build\temp.win-amd64-2.7\Release\libimaging\quanthash.o build\temp.win-amd64-2.7\Release\libimaging\quantheap.o build\temp.win-amd64-2.7\Release\libimaging\pcddecode.o build\temp.win-amd64-2.7\Release\libimaging\pcxdecode.o build\temp.win-amd64-2.7\Release\libimaging\pcxencode.o build\temp.win-amd64-2.7\Release\libimaging\point.o build\temp.win-amd64-2.7\Release\libimaging\rankfilter.o build\temp.win-amd64-2.7\Release\libimaging\rawdecode.o build\temp.win-amd64-2.7\Release\libimaging\rawencode.o build\temp.win-amd64-2.7\Release\libimaging\storage.o build\temp.win-amd64-2.7\Release\libimaging\sunrledecode.o build\temp.win-amd64-2.7\Release\libimaging\tgarledecode.o build\temp.win-amd64-2.7\Release\libimaging\unpack.o build\temp.win-amd64-2.7\Release\libimaging\unpackycc.o build\temp.win-amd64-2.7\Release\libimaging\unsharpmask.o build\temp.win-amd64-2.7\Release\libimaging\xbmdecode.o build\temp.win-amd64-2.7\Release\libimaging\xbmencode.o build\temp.win-amd64-2.7\Release\libimaging\zipdecode.o build\temp.win-amd64-2.7\Release\libimaging\zipencode.o build\temp.win-amd64-2.7\Release\_imaging.def -LC:\Python27\lib -LC:\Python27\libs -LC:\Python27\PCbuild\amd64 -lkernel32 -luser32 -lgdi32 -lpython27 -lmsvcr90 -o build\lib.win-amd64-2.7\_imaging.pyd 

從本次通話的錯誤開始了,如:

build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x70): undefined reference to `__imp__PyFloat_Type' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x78): undefined reference to `__imp__PyFloat_Type' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x85): undefined reference to `__imp__PyType_IsSubtype' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0xc9): undefined reference to `__imp__PyFloat_Type' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0xd1): undefined reference to `__imp__PyFloat_Type' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0xde): undefined reference to `__imp__PyType_IsSubtype' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x113): undefined reference to `__imp__PyExc_TypeError' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x11e): undefined reference to `__imp__PyErr_SetString' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x132): undefined reference to `__imp__PyExc_TypeError' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x13d): undefined reference to `__imp__PyErr_SetString' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x194): undefined reference to `__imp__PyInt_AsLong' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x1a3): undefined reference to `__imp__PyErr_Occurred' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x23e): undefined reference to `__imp__PyArg_ParseTuple' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x285): undefined reference to `__imp__PyArg_ParseTuple' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x316): undefined reference to `__imp__PyInt_AsLong' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x325): undefined reference to `__imp__PyErr_Occurred' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x341): undefined reference to `__imp__PyFloat_AsDouble' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x35f): undefined reference to `__imp__PyErr_Occurred' 
build\temp.win-amd64-2.7\Release\_imaging.o:_imaging.c:(.text+0x393): undefined reference to `__imp__PyInt_AsLong' 

我認爲這些奇怪的不確定的東西是Python的C API的一部分。那麼,如果gcc調用包含-lpython27,爲什麼我會得到這些錯誤呢?

+0

什麼操作系統您使用:

您可以用安裝PIL? Windows中有這方面的已知問題。 – jdotjdot

+0

對不起,添加了我的操作系統。它的Windows 7 64位 – Mark

回答

0

作爲Python包安裝的一部分,在Windows中進行編譯時存在很多已知問題。我建議你去過去爲我工作的Unofficial Windows Binaries

easy_install http://www.lfd.uci.edu/~gohlke/pythonlibs/xos8d83j/PIL-fork-1.1.7.win-amd64-py2.7.exe 
+1

感謝您的解決方法,但我仍然想知道爲什麼編譯器不成功。這不符合編譯器的bug嗎? – Mark

+0

也許是一個編譯器錯誤,但它肯定更復雜,並且有很多移動部件可以使編譯器在Windows上工作。請參閱[這裏](http://stackoverflow.com/questions/10281102/gcc-compilation-error-from-python),並查找其他Windows gcc編譯問題;你會發現很多關於它的報道。至於爲什麼它不起作用,我不完全知道。但我知道這是一個懸而未決的問題 - 我忘了是用Python還是用GCC或者Mingw。 – jdotjdot