-------------------------------------------------------------------- PIL 1.1.7 SETUP SUMMARY -------------------------------------------------------------------- version 1.1.7 platform darwin 2.6.9 (unkNown,Sep 9 2014,15:05:12) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] -------------------------------------------------------------------- --- TKINTER support available --- JPEG support available --- ZliB (PNG/ZIP) support available --- FREETYPE2 support available *** liTTLECMS support not available --------------------------------------------------------------------
但是当我运行代码时,得到一些错误消息,可能告诉我我没有安装JPEG库
/System/library/Frameworks/Python.framework/Versions/2.7/bin/python2.7 /Users/tian/PycharmProjects/helloworld/image_test.pyTraceback (most recent call last): file "/Users/tian/PycharmProjects/helloworld/image_test.py",line 35,in <module> image.save('code.jpg','jpeg') file "/library/Python/2.7/site-packages/PIL/Image.py",line 1439,in save save_handler(self,fp,filename) file "/library/Python/2.7/site-packages/PIL/JpegImagePlugin.py",line 471,in _save Imagefile._save(im,[("jpeg",(0,0)+im.size,rawmode)]) file "/library/Python/2.7/site-packages/PIL/Imagefile.py",line 495,in _save e = Image._getencoder(im.mode,e,a,im.encoderconfig) file "/library/Python/2.7/site-packages/PIL/Image.py",line 401,in _getencoder raise IOError("encoder %s not available" % encoder_name)IOError: encoder jpeg not available
当我在Google中搜索此错误的原因时,大部分解决方案是重新安装PIL,但是当我安装PIL时,我得到了“JPEG支持可用”消息,因此它不应该由JPEG库引起.那我该怎么解决这个问题呢?
我的 *** 作系统是OS X Yosemite 10.10
解决方法 我通过使用Pillow而不是PIL解决了这个问题,并使用“form PIL import Image”而不是“import Image”. 总结以上是内存溢出为你收集整理的python-2.7 – IOError:OS X 10.10上没有编码器jpeg全部内容,希望文章能够帮你解决python-2.7 – IOError:OS X 10.10上没有编码器jpeg所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)