[英]RaspberryPi: ImportError: No module named cv2 in Geany
I installed opencv in RaspberryPi (using this link)and import in termial and python3 (idle). 我在RaspberryPi中安装了opencv(使用此链接)并在termial和python3(idle)中导入。 It shows no error in these two as shown in below images.
它显示这两个中没有错误,如下图所示。
But, when I tried to run import cv2 in Geany, it shows error given below: 但是,当我尝试在Geany中运行import cv2时,它会显示以下错误:
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? 我怎么能解决这个问题?
I solved this problem by changing python to python3 in Geany. 我在Geany中将python更改为python3解决了这个问题。 For this, Go to
Build->Set Build Commands
in Geany menu. 为此,请转到Geany菜单中的
Build->Set Build Commands
。 In Set Build Commands
window, under Python commands
label in compile line python m py_compile
will be there. 在
Set Build Commands
窗口中,在Python commands
下,编译行中的标签python m py_compile
将在那里。 Similarly, under Executive commands
label in executive line python "%f"
will be there. 类似地,在
Executive commands
下,执行行中的标签python "%f"
将存在。 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. 我将
python m py_compile
更改为python3 m py_compile
,将python "%f"
更改为python3 "%f"
( 如图1和图2所示 ),上述问题得到解决。
Image 1. 图片1。
Image2. 镜像2。
Thanks. 谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.