如何在Mac OS X上安装Python图像库?
我还是个编程小白,之前做过一些有趣的算法编程,但老实说,我对库和编程语言是怎么结合在一起的完全不懂。现在我需要做一个项目,涉及到一些图像处理,所以我一直在尝试安装PIL库,但一直没成功。
我去到http://www.pythonware.com/products/pil/,下载了“Python Imaging Library 1.1.6 源代码包(适用于所有平台)(440k TAR GZ)(2006年12月3日)”。然后我在命令提示符下打开了这个文件夹,并运行了
$ python setup.py build_ext -i .
这是我得到的输出:
running build_ext
--- using frameworks at /System/Library/Frameworks
building '_imaging' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -fno-common -dynamic -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DMACOSX -I/usr/include/ffi -DENABLE_DTRACE -arch i386 -arch ppc -pipe -DHAVE_LIBZ -IlibImaging -I/opt/local/include -I/System/Library/Frameworks/Python.framework/Versions/2.5/include -I/usr/local/include -I/usr/include -I/System/Library/Frameworks/Python.framework/Versions/2.5/include/python2.5 -c _imaging.c -o build/temp.macosx-10.5-i386-2.5/_imaging.o
unable to execute gcc: No such file or directory
error: command 'gcc' failed with exit status 1
当我尝试“import Image”时,出现了错误。
你们知道这是怎么回事吗?我用的是一台配有Core 2 Duo的MacBook Pro。
如果这个问题听起来很傻,我真的很抱歉。
4 个回答
0
GCC是GNU编译器。这个工具非常有用。你只需要用适合Mac的方式安装它就可以了。
http://www.tech-recipes.com/rx/726/mac-os-x-install-gcc-compiler/
3
你需要安装在你的Mac OS X安装光盘上的开发者工具。