简体   繁体   English

如何在NVIDIA Jetson TX2上从openCV(从源代码构建)运行python?

[英]How to run python from openCV (built from source) on the NVIDIA Jetson TX2?

I downloaded openCV from github and built it from source because I need a very specific release from openCV ie openCV2.4 . 我从github下载了openCV并从源代码构建它,因为我需要openCV的一个非常具体的版本,即openCV2.4。 When trying to run some code written in Python, I get "No module named cv2". 当试图运行一些用Python编写的代码时,我得到“没有名为cv2的模块”。

I therefor tried pip install python-opencv . 我因此尝试了pip install python-opencv But this returns Could not find a version that satisfies the requirement opencv-python (from version: ) No match distribution for opencv-python 但是这返回Could not find a version that satisfies the requirement opencv-python (from version: ) No match distribution for opencv-python

What can I do to solve the "No module named cv2" issue? 我该怎么做才能解决“没有名为cv2的模块”问题?

I also tried this straight in the command line 我也在命令行中尝试了这一点

$python
>>>>import cv2

which returns no module named cv2 and 它不返回名为cv2和的模块

$python3
>>>>import cv2

which returns no module named cv2 as well. 它也不返回名为cv2的模块。

I am however totally able to compile my C++ code. 但是我完全能够编译我的C ++代码。 Which means the installation was somehow successful, but something fails on the Python side. 这意味着安装在某种程度上是成功的,但在Python方面失败了。

related to my issue: https://devtalk.nvidia.com/default/topic/809406/jetson-tk1-opencv-python-quot-import-cv2-quot-/?offset=4#5207884 与我的问题有关: https//devtalk.nvidia.com/default/topic/809406/jetson-tk1-opencv-python-quot-import-cv2-quot-/?offset = 4#5207884

and

https://devtalk.nvidia.com/default/topic/1023652/jetson-tx2/how-can-i-run-quot-pip-install-opencv-python-quot-/?offset=5#5207902 https://devtalk.nvidia.com/default/topic/1023652/jetson-tx2/how-can-i-run-quot-pip-install-opencv-python-quot-/?offset=5#5207902

EDIT: 编辑:

I was suggested to run cmake with this flag set -DBUILD_opencv_python2=ON , but this flag doesn't seem to exist because when using cmake-gui I couldn't see it anywehere and when passing it in the terminal as a paramerer I get Manually specified variables were not used by the project: BUILD_opencv_python 我被建议使用这个标志设置-DBUILD_opencv_python2=ON来运行cmake,但是这个标志似乎不存在,因为当使用cmake-gui我无法看到任何地方并且当它作为参数传递到终端时我得到Manually specified variables were not used by the project: BUILD_opencv_python

我能够在Jetson TX2上使用Jetpack 3.1安装OpenCV 3.4.1 for python,并在此处指示。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM