1

I installed opencv in RaspberryPi (using this link)and import in termial and python3 (idle). It shows no error in these two as shown in below images.

enter image description here enter image description here

But, when I tried to run import cv2 in Geany, it shows error given below:

Traceback (most recent call last):
  File "import.py", line 1, in <module>
    import cv2
ImportError: No module named cv2

How I can solve this problem?

Naseeb Gill
  • 661
  • 10
  • 23
  • 3
    Does geany point to your python3 installation or to python 2? If no, go here: https://stackoverflow.com/questions/29105941/how-do-i-make-python3-the-default-python-in-geany – Dschoni Jun 17 '19 at 11:58
  • Thanks @Dschoni. I solved by the link which you provided. – Naseeb Gill Jun 18 '19 at 07:11

1 Answers1

1

I solved this problem by changing python to python3 in Geany. For this, Go to Build->Set Build Commands in Geany menu. In Set Build Commandswindow, under Python commands label in compile line python m py_compile will be there. Similarly, under Executive commands label in executive line python "%f" will be there. I changed python m py_compile into python3 m py_compile and python "%f" into python3 "%f" (as shown in images 1 and 2) and above-mentioned problem get solved.

Image 1.

enter image description here

Image2.

**enter image description here**

Thanks.

Naseeb Gill
  • 661
  • 10
  • 23