6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

python3で import cv2 ModuleNotFoundError: No module named 'cv2'

Posted at

##概要
ちょっと動かしたいopencvを使ったpyhtonのプログラムがあったので、
以下の様に実行した。

python3 "動かしたいプログラム.py"

そうすると、次のようなエラーが出た

Traceback (most recent call last):
  File "動かしたいプログラム.py", line 21, in <module>
    import cv2
ModuleNotFoundError: No module named 'cv2'

##環境

  • Ubuntu 18.04 64bit
  • opencv 4.2.0
  • python 3.6.9

Solution

Qiitaのこのページを参考に、以下のコマンドを実行した。

pip install opencv-python

で、もう一度importできるかどうか確認

>>> import cv2
>>> print( cv2.__version__ )
4.4.0
>>> 

できた。

昨日寒かったなあ
2020年11月7日

6
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?