jetsonhacks / buildOpenCVTX2

Build and install OpenCV for the NVIDIA Jetson TX2
MIT License
276 stars 153 forks source link

Example Error - Python is missing OpenCV #15

Open JohannesBetz opened 6 years ago

JohannesBetz commented 6 years ago

Hello,

i did you installation tutorial as you said. But it seems like, my python doesnt know which OpenCV version to use. When i try your Example, i get an error and the hint, that python is accessing openCV version 3.3.1 The error looks like this Called with args: Namespace(video_device=0) OpenCV version: 3.3.1-dev ('Device Number:', 0) camera open failed I think python doesnt know that i build openCV from source. I double checked in the terminal an i get these issues:

`nvidia@tegra-ubuntu:~/OpenCVTX2/Examples$ python3 Python 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information.

import cv Traceback (most recent call last): File "", line 1, in ImportError: No module named 'cv' import cv2 Traceback (most recent call last): File "", line 1, in ImportError: /opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so: undefined symbol: PyCObject_Type ` What have i done wrong in the build process?

jetsonhacks commented 6 years ago

It is using the PYTHONPATH which is set to the ROS 2.7 OpenCV version:

/opt/ros/kinetic/lib/python2.7/dist-packages/cv2.so

ROS uses its own OpenCV library.

joonr7 commented 5 years ago

Easiest way: Remove ROS from your jetson. Then set the path of opencv. If you don't want remove ROS, you have to separate non-ROS usage and ROS usage.

I believe you can control from your ~/.bashrc file. There should be "source /opt/ros/{$ROS_DISTRO}/setup.bash" or something like that.