运行 Hello World 程序时的 SimpleCV IOError
SimpleCV IOError When Running Hello World Program
几天来,我一直在尝试在我的 Mac 上设置 SimpleCV。我终于安装了所有东西,但是 运行 hello world 程序
from SimpleCV import Camera
# Initialize the camera
cam = Camera()
# Loop to continuously get images
while True:
# Get Image from camera
img = cam.getImage()
# Make image black and white
img = img.binarize()
# Draw the text "Hello World" on image
img.drawText("Hello World!")
# Show the image
img.show()
在他们的主页上发现returns以下错误:
File "helloworld.py", line 13, in <module>
img.show()
File "/usr/local/lib/python2.7/site-packages/SimpleCV/ImageClass.py", line 5447, in show
d = Display(self.size())
File "/usr/local/lib/python2.7/site-packages/SimpleCV/Display.py", line 158, in __init__
scvLogo = SimpleCV.Image("simplecv").scale(32,32)
File "/usr/local/lib/python2.7/site-packages/SimpleCV/ImageClass.py", line 787, in __init__
self._pil = pil.open(self.filename).convert("RGB")
File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 2237, in open
fp = builtins.open(fp, "rb")
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/SimpleCV/sampleimages/simplecv.png'
Cleaned up camera.
经过反复试验,我最终得到了以下 brew 包:
atk eigen glib isl mercurial pcre scipy swig
autoconf fontconfig gmp jpeg mpfr pixman sdl webp
automake freetype gobject-introspection libffi numpy pkg-config sdl_image xz
brew-cask gcc gtk+ libmpc opencv portmidi sdl_mixer
cairo gdbm harfbuzz libpng openexr pygame sdl_ttf
cloog gdk-pixbuf icu4c libtiff openssl python smpeg
cmake gettext ilmbase libtool pango readline sqlite
和以下 pip 包:
funcsigs (0.4)
gnureadline (6.3.3)
ipython (2.3.1)
mercurial (3.2.4)
nose (1.3.4)
numpy (1.9.1)
obd (0.2.0)
Pillow (2.7.0)
pip (6.0.6)
pygame (1.9.1release)
pyparsing (2.0.3)
pyserial (2.7)
scipy (0.14.0)
setuptools (11.3.1)
SimpleCV (1.3)
six (1.9.0)
svgwrite (1.1.6)
安装在我的系统上。
其中一个 ubuntu/pip 包丢失了该文件,它破坏了一切。你的文件没有问题。如果您可以从 github 源构建,那将是最好的选择,并且会为您提供更多模块。 This 应该会有帮助。
几天来,我一直在尝试在我的 Mac 上设置 SimpleCV。我终于安装了所有东西,但是 运行 hello world 程序
from SimpleCV import Camera
# Initialize the camera
cam = Camera()
# Loop to continuously get images
while True:
# Get Image from camera
img = cam.getImage()
# Make image black and white
img = img.binarize()
# Draw the text "Hello World" on image
img.drawText("Hello World!")
# Show the image
img.show()
在他们的主页上发现returns以下错误:
File "helloworld.py", line 13, in <module>
img.show()
File "/usr/local/lib/python2.7/site-packages/SimpleCV/ImageClass.py", line 5447, in show
d = Display(self.size())
File "/usr/local/lib/python2.7/site-packages/SimpleCV/Display.py", line 158, in __init__
scvLogo = SimpleCV.Image("simplecv").scale(32,32)
File "/usr/local/lib/python2.7/site-packages/SimpleCV/ImageClass.py", line 787, in __init__
self._pil = pil.open(self.filename).convert("RGB")
File "/usr/local/lib/python2.7/site-packages/PIL/Image.py", line 2237, in open
fp = builtins.open(fp, "rb")
IOError: [Errno 2] No such file or directory: '/usr/local/lib/python2.7/site-packages/SimpleCV/sampleimages/simplecv.png'
Cleaned up camera.
经过反复试验,我最终得到了以下 brew 包:
atk eigen glib isl mercurial pcre scipy swig
autoconf fontconfig gmp jpeg mpfr pixman sdl webp
automake freetype gobject-introspection libffi numpy pkg-config sdl_image xz
brew-cask gcc gtk+ libmpc opencv portmidi sdl_mixer
cairo gdbm harfbuzz libpng openexr pygame sdl_ttf
cloog gdk-pixbuf icu4c libtiff openssl python smpeg
cmake gettext ilmbase libtool pango readline sqlite
和以下 pip 包:
funcsigs (0.4)
gnureadline (6.3.3)
ipython (2.3.1)
mercurial (3.2.4)
nose (1.3.4)
numpy (1.9.1)
obd (0.2.0)
Pillow (2.7.0)
pip (6.0.6)
pygame (1.9.1release)
pyparsing (2.0.3)
pyserial (2.7)
scipy (0.14.0)
setuptools (11.3.1)
SimpleCV (1.3)
six (1.9.0)
svgwrite (1.1.6)
安装在我的系统上。
其中一个 ubuntu/pip 包丢失了该文件,它破坏了一切。你的文件没有问题。如果您可以从 github 源构建,那将是最好的选择,并且会为您提供更多模块。 This 应该会有帮助。