LoginSignup
7
7

More than 3 years have passed since last update.

WindowsにPython3とOpenCVをインストールする

Last updated at Posted at 2019-09-11

こんにちは。Ideagearの林です。
今回はオープンソースの画像動画ライブラリであるOpenCVと、そのインストールに必要なPython3のインストール方法についてまとめていきたいと思います。

環境

Windows7 32ビット版(XP以前ではインストールできないようです)
今回インストールしたバージョンはPython 3.7.4です。

python3のインストール

まずここからパッケージをダウンロードします。

基本的に左側のStable Releasesの中から上部の一番バージョンが高いものを選べばOKです(下図ではPython 3.7.4)

image.png

32bit版Windowsにインストールするなら

Windows x86 web-based installer

64bit版なら

Windows x86-64 web-based installer

をダウンロードします。


次に、ダウンロードしたパッケージを実行します。

image.png

Add Python 3.x to PATH をチェックします。

Install now をクリックしてインストールを開始します。

OpenCVのインストール

Python 3がインストールできたら、pipコマンドを利用して、OpenCVをインストールできます。

コマンドプロンプトを開き、(Windowsキー+rを押し、cmdと入力する等)

pip install opencv-python

を実行すると、インストールが開始されます。

image.png

OpenCVのライブラリが利用できるかをthon確かめて、正しくOpenCVがインストールされているかどうかを確認できます。コマンドプロンプトで

python

を入力して対話型実行環境を起動し、

import cv2

を入力してエラーが出なければ成功です。

image.png

以上で、無事にインストールできました。
おつかれさまでした。

参考にしたサイト様

https://www.python.jp/install/windows/install_py3.html
https://news.mynavi.jp/article/zeropython-34/

7
7
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
7
7