SimpleCV install and "You need the python image library to save by filehandle"
2015年5月3日 22:15:43
在win7下安装了python、simplecv,试着运行simplecv官网第一个hello world程序结果报错,提示说%python%/lib/site-packages/SimpleCV/sampleimages目录不存在。果然,是pypi源中的压缩包根本就没有把官方repo中的sampleimages目录放进去,手动下载官方repo去了:https://github.com/sightmachine/SimpleCV/zipball/1.3 (好吧其实是搬运https://github.com/sightmachine/SimpleCV上的内容)
前面已经装了python,把opencv安装包中的cv.py和cv2.pyd扔到python的site-packages和DLL目录下了,并且安装了PIL等各种官网说的依赖包,运行后报错说
"you need the python library to save by file handle"
通过把%python%/Lib/site-packages/SimpleCV/base.py中的一句import修改掉,就能运行了:
change the following line***:
from Image.GifImagePlugin import getheader, getdata
into:
from GifImagePlugin import getheader, getdata
然后重新运行,Done
=======================
修改base.py的内容也是搬运的,以下是原文
=======================
SimpleCV install and "You need the python image library to save by filehandle"
You'll maybe complain that this site is degenerating into a mingle-mangle of bug descriptions, but if you've ever had a pesky problem and couldn't find anything about it on the web, you'll understand my urge to document such things for the fellow hackers.
Here the story goes: SimpleCV is a Python framework trying to provide a simple interface to both OpenCV* an PIL**. There's even a small book about it. I first installed version 1.2 on my computer, but then wanted to upgrade to 1.3 as there were some segmentation algorithms added (graph-cut etc.) which I wanted to use. Unfortunately, as I installed the new SimpleCV 1.3 and then tried to run my script written for version 1.2 I got:
WARNING: You need the python image library to save by filehandle
when I tried to display any image. Deinstallation of both versions an clean install followed, but nothing changed. Googling for solution didn't help either. What should we do? Just fix it by yourself! The solution is simple. Well, just open this file:
C:\Python27\Lib\site-packages\SimpleCV\base.py
and change the following line***:
from Image.GifImagePlugin import getheader, getdata
into:
from GifImagePlugin import getheader, getdata
So, that's it! And happy OpenCV hacking!
PS: PIL seems to be generally a difficult library to use on Windows. If you follow their own docs an write something like
from PIL import Image
it won't work! You have to use the little bit confusing:
import Image
--
- OpenCV: a C++ library containing image processing algorithms. For Python there are wrappers exposing direct calls to it, but they aren't that easy to be used directly.
** PIL: the "python image library " from the warning message - the best know imaging library for Python, however it isn't self-contained. You'll need several other libraries like sciPy etc.
*** somehow for Windows distribution the GifImagePlugin isn't a subpackage of Image, and the PIL package just isn't there to be used as prefix! Despite the warning, the problem isn't lack of the PIL installation, but failure to find one of it's subpackages.
Posted by Marek Krj at 03:55
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: computer vision, Python
SimpleCV install and "You need the python image library to save by filehandle"的更多相关文章
- Install OpenCV 3.0 and Python 2.7+ on OSX
http://www.pyimagesearch.com/2015/06/15/install-OpenCV-3-0-and-Python-2-7-on-osx/ As I mentioned las ...
- Install OpenCV 3.0 and Python 2.7+ on Ubuntu
为了防止原文消失或者被墙,转载留个底,最好还是去看原贴,因为随着版本变化,原贴是有人维护升级的 http://www.pyimagesearch.com/2015/06/22/install-Open ...
- 在执行 pip install 时遇到错误:python setup.py egg_info ...
最近重新安装win10 64位专业版, 正好遇到python3.8发布,试了一下.结果jupyter都安装不了...心碎. ERROR: Command errored out with exit s ...
- CentOS 6.5 Python Image Library 配置
转自:http://www.cnblogs.com/way_testlife/archive/2011/04/17/2019013.html PIL 下载: http://www.pythonware ...
- 使用Python Shapefile Library创建和编辑Shapefile文件
介绍 shapefile是GIS中非常重要的一种数据类型,在ArcGIS中被称为要素类(Feature Classes),主要包括点(point).线(polyline)和多边形(polygon).P ...
- Windows环境下安装PIL(Python Imaging Library)库
微信小程序--跳一跳最近火了一把,于是整了个辅助进行试玩,不过在运行程序过程中出现了个报错如图所示: 显然是缺少PIL(Python Imaging Library)库文件,于是通过pip命令行进行安 ...
- Python语言中对于json数据的编解码——Usage of json a Python standard library
一.概述 1.1 关于JSON数据格式 JSON (JavaScript Object Notation), specified by RFC 7159 (which obsoletes RFC 46 ...
- Python Standard Library
Python Standard Library "We'd like to pretend that 'Fredrik' is a role, but even hundreds of vo ...
- The Python Standard Library
The Python Standard Library¶ While The Python Language Reference describes the exact syntax and sema ...
随机推荐
- 解题:AHOI 2005 航线规划
题面 这种不断删边的首先肯定想到时光倒流啊=.= 在最后剩下的连通图上跑出一棵搜索树,先将边权都赋为$1$,那么两点间的关键航线就是链上边权和,而每加入一条非树边$u,v$都会使得$u,v$链上的边的 ...
- 驱动之NandFlash的介绍与应用20170209
本文主要介绍的是NAND FLASH的介绍与应用,直接看个人笔记即可:
- [转载]DataView详解
表示用于排序.筛选.搜索.编辑和导航的 DataTable 的可绑定数据的自定义视图. DataView的功能类似于数据库的视图,他是数据源DataTable的封装对象,可以对数据源进行排序.搜索.过 ...
- 使用Masonry在UIScrollView内布局
理论分析 首先,我们知道Autolayout改变了传统的以frame为主的布局思想.它其实是一种相对布局,核心思想是视图与视图之间的位置关系.比如,我们可以根据矩形的起始横坐标.纵坐标.长和宽这四个变 ...
- 阿里云 centos7 tomcat 启动巨慢的解决方法(几分钟)
方法一: 通过修改Tomcat启动文件-Djava.security.egd=file:/dev/urandom 通过修改JRE中的java.security文件securerandom.source ...
- [linux]linux调度策略对io的影响
题记:原本要写nfs的I/O小测试的,但考虑到只是的完整性和系统性,转一篇调度策略相关文章. 1.linux中的调度策略 参考:http://scoke.blog.51cto.com/769125/4 ...
- C++模式设计-多线程下的单例模式
1 教科书里的单例模式 我们都很清楚一个简单的单例模式该怎样去实现:构造函数声明为private或protect防止被外部函数实例化,内部保存一个private static的类指针保存唯一的实例,实 ...
- hihoCoder #1582 : Territorial Dispute 凸包
#1582 : Territorial Dispute 时间限制:1000ms 单点时限:1000ms 内存限制:256MB 描述 In 2333, the C++ Empire and the Ja ...
- Qt ------ 控件布局 setSizePolicy
setSizePolicy 是设置控件在布局(layout)里面的大小变化的属性.如果控件没有在布局里,没什么用. 默认情况下,把 widget 放入 layout,widget 的大小一定程度上会随 ...
- need
php面试题: http://lib.csdn.net/article/php/43624 小程序: 官方手册: https://mp.weixin.qq.com/debug/wxadoc/dev/d ...