# python opencv on tk1

**URL:** <https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693>\
**Category:** Jetson TK1\
**Created:** [June 11, 2017, 9:24am UTC](https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693 "2017-06-11T09:24:28Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![SagiS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/sagis/32/17483_2.png) [@SagiS](https://forums.developer.nvidia.com/u/SagiS)\
**Post date:** [June 11, 2017, 9:24am UTC](https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693/1 "2017-06-11T09:24:28Z")

</div>

I am trying to use python opencv on a tk1  
Jetpack 2.4  
Based on some instruction on [https://devtalk.nvidia.com/default/topic/809406/?comment=4458946](https://devtalk.nvidia.com/default/topic/809406/?comment=4458946) I found some instructions:

```auto
sudo apt-get install libopencv4tegra-python

```

which installs fine, but I still cannot import cv2 into python.  
I tried installing the python packages…

```auto
pip install opencv-python
pip install python-opencv

```

but neither is found.  
Any ideas on how to get this to run?

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [June 12, 2017, 3:03am UTC](https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693/2 "2017-06-12T03:03:28Z")

</div>

Hi,

Here is the steps:  
**1.** Install opencv4tegra via JetPack

**2.** Install python wrapper

```auto
sudo apt-get install python-opencv

```

**3.** Test

```auto
python
import cv2
....

```

---

<div class="post-metadata">

**Author:** ![SagiS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/sagis/32/17483_2.png) [@SagiS](https://forums.developer.nvidia.com/u/SagiS)\
**Post date:** [June 15, 2017, 6:05am UTC](https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693/3 "2017-06-15T06:05:24Z")

</div>

```auto
sudo apt-get install libopencv4tegra-python
sudo apt-get install python-opencv
python
Python 2.7.6 (default, Oct 26 2016, 20:46:32)
[GCC 4.8.4] on linux2
...
>>> import cv2
Traceback (most-recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named cv2
>>>

```

---

<div class="post-metadata">

**Author:** ![AastaLLL](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/aastalll/32/14043_2.png) [@AastaLLL](https://forums.developer.nvidia.com/u/AastaLLL)\
**Post date:** [June 15, 2017, 7:57am UTC](https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693/4 "2017-06-15T07:57:44Z")

</div>

Hi,

Could you explain what you mean?  
Does ‘sudo apt-get install python-opencv’ return error?

---

<div class="post-metadata">

**Author:** ![SagiS](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/sagis/32/17483_2.png) [@SagiS](https://forums.developer.nvidia.com/u/SagiS)\
**Post date:** [June 15, 2017, 2:25pm UTC](https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693/5 "2017-06-15T14:25:55Z")

</div>

I resolved the problem.  
I was doing all the above inside a python virtualenv and that seems to work fine, but has no effect. when I exit the virtual env it works fine.  
So… to get python opencv installed, do the following _outsite_ your virtual env:

```auto
sudo apt-get install libopencv4tegra-python
sudo apt-get install python-opencv

```

Ignore some posts elsewhere that instruct you to “pip install” stuff.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [October 18, 2021, 6:45pm UTC](https://forums.developer.nvidia.com/t/python-opencv-on-tk1/50693/6 "2021-10-18T18:45:11Z")

</div>


