Ubuntu16.06安装opencv

安装

安装opencv-python

pip3 install opencv-python

测试是否安装成功

import cv2
cv2.__version__

安装产生问题:

After I install ROS kinetic: http://wiki.ros.org/kinetic/Installation/Ubuntu
And open python3 and run import cv2, got following error:

Python 3.5.2 (default, Nov 17 2016, 17:05:23) 
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
Traceback (most recent call last):
  File "", line 1, in <module>
ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type

step 1

找到cv2.so的安装路径

/usr/local/lib/python3.5/dist-package‌​s

导出path到家目录(~)下的.bashrc

export PYTHONPATH="/usr/local/lib/python3.5/dist-package‌​s:$PYTHONPATH"

reference

https://stackoverflow.com/questions/43019951/after-install-ros-kinetic-cannot-import-opencv?newreg=1fc9099ecd744c83adf801f027971739

你可能感兴趣的:(深度学习)