SimpleCV NameError:未定义名称“图像" [英] SimpleCV NameError: name 'images' is not defined
问题描述
我尝试Library SimpleCV.我有Ubuntu 11.10,带PIL的Python 2.7(python-imaging版本1.1.7-3ubuntu1)
根据安装说明,我下载了SimpleCV_1.1_linux_all.deb软件包.然后我安装: sudo apt-get安装python-numpy python-scipy.
由于Ubuntu 11.10具有python-opencv库,所以我不会安装任何其他opencv库(我不会从OpenCV 2.1升级到OpenCV 2.3).然后我安装了SimpleCV_1.1_linux_all.deb软件包.它安装到/usr/lib/pymodules/python2.7/SimpleCV.我尝试测试该库并遇到问题:
#!/usr/bin/python
from SimpleCV import *
my_image = Image(images/redeye.jpg)<br>
my_image.show()
显示错误:
回溯(最近通话最近):
中第6行的文件"./simplecvimg.py" my_image =图片(images/redeye.jpg)
NameError:未定义名称图像"
将images/redeye.jpg
作为字符串传递:Image("images/redeye.jpg")
.
my_image = Image("images/redeye.jpg")
您当前正在将其从字面上传递给Image()
类,因此为什么python将其解释为变量,并因此引发NameError
异常,因为未找到images
本地或全局名称. /p>
I try Library SimpleCV. I have Ubuntu 11.10, Python 2.7 with PIL (python-imaging ver. 1.1.7-3ubuntu1)
According to Install instructions I downloaded SimpleCV_1.1_linux_all.deb package. Then I install: sudo apt-get install python-numpy python-scipy.
Since Ubuntu 11.10 has python-opencv library I don't install any other opencv library (I dont upgrade from OpenCV 2.1 to OpenCV 2.3) library. Then I installed SimpleCV_1.1_linux_all.deb package. It installed to /usr/lib/pymodules/python2.7/SimpleCV. I try test this library and have problem:
#!/usr/bin/python
from SimpleCV import *
my_image = Image(images/redeye.jpg)<br>
my_image.show()
it shows error:
Traceback (most recent call last):
File "./simplecvimg.py", line 6, in
my_image = Image(images/redeye.jpg)
NameError: name 'images' is not defined
Pass images/redeye.jpg
as a string: Image("images/redeye.jpg")
.
my_image = Image("images/redeye.jpg")
You are currently passing that literally to the Image()
class, hence why python is intepreting it as a variable, and as such, raising a NameError
exception because the images
local or global name is not found.
这篇关于SimpleCV NameError:未定义名称“图像"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!