当前位置: 首页 > 工具软件 > SimpleCV > 使用案例 >

ubuntu16.04安装SimpleCV

微生青青
2023-12-01
sudo apt-get install ipython python-opencv python-scipy python-numpy python-pygame python-setuptools git
git clone https://github.com/sightmachine/SimpleCV.git
cd SimpleCV/
sudo pip install -r requirements.txt

1.

当执行到上面指令报错,提示没有找到PIL对应的库时,PIL的名字更改了Pillow,

手动修改 文件 requirements.txt,把PIL替换成Pillow

2.

如果报其他错误,提示如下错误时:

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    from pip import main

在终端输入

sudo gedit /usr/bin/pip

这时打开了pip文件,修改

from pip import main  
if __name__ == '__main__':  
    sys.exit(main()) 

from pip import __main__ 
if __name__ == '__main__':  
    sys.exit(__main__._main())

3.

将SimpleCV安装到系统内

sudo python setup.py install

4.

安装好之后,测试是否能成功执行

在终端上输入

SimpleCV

如果没有报错则成功安装,

如果报错,提示如下:

    from SimpleCV.base import *
  File "/usr/local/lib/python2.7/dist-packages/SimpleCV-1.3-py2.7.egg/SimpleCV/base.py", line 60, in <module>
    raise ImportError("Cannot load OpenCV library which is required by SimpleCV")
ImportError: Cannot load OpenCV library which is required by SimpleCV

在终端进入Python,并输入以下代码,看是否成功执行

import cv
print cv.__file__
import cv2
print cv2.__file__

以下是我电脑执行的情况

>>> import cv
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/cv.py", line 1, in <module>
    from cv2.cv import *
ImportError: No module named cv
>>> import cv2
>>> print cv2.__file__
/opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so

cv没有执行成功,cv2的库能成功导入,同时输出其存储位置,打开新的终端,将路径切换到在cv2.so文件所在的文件夹,每个电脑里面安装cv2的路径可能不一样,通过Python去找到其对应的地址

执行如下命令

mv cv2.so cv2.pyd

5.

在终端输入

SimpleCV

如果成功运行,则会出现如下提示

/usr/lib/python2.7/dist-packages/IPython/frontend.py:30: UserWarning: The top-level `frontend` package has been deprecated. All its subpackages have been moved to the top `IPython` level.
  warn("The top-level `frontend` package has been deprecated. "
+-----------------------------------------------------------+
 SimpleCV 1.3.0 [interactive shell] - http://simplecv.org
+-----------------------------------------------------------+

Commands: 
	"exit()" or press "Ctrl+ D" to exit the shell
	"clear()" to clear the shell screen
	"tutorial()" to begin the SimpleCV interactive tutorial
	"example()" gives a list of examples you can run
	"forums()" will launch a web browser for the help forums
	"walkthrough()" will launch a web browser with a walkthrough

Usage:
	dot complete works to show library
	for example: Image().save("/tmp/test.jpg") will dot complete
	just by touching TAB after typing Image().

Documentation:
	help(Image), ?Image, Image?, or Image()? all do the same
	"docs()" will launch webbrowser showing documentation

SimpleCV:1> 

以上是我个人安装过程中出现的问题。

 类似资料: