PythonインストールOpenCV

9887 ワード

python-3.7.3-amd 64をインストールします.exeコマンドラインはあなたのPythonのインストールディレクトリのScriptsの下に入ります:D:Program FilesPython 37Scripts
インストールpip
Pythonインストールディレクトリの下のScriptsパスに入り、easy_install.exe pipを実行します.
インストールwheel
Pythonインストールディレクトリの下のScriptsパスに入り、pip install wheelを実行します.
インストールnumpy
Pythonインストールディレクトリの下のScriptsパスに入り、pip install numpyを実行します.
Opencvのインストール
Pythonインストールディレクトリの下のScriptsパスに入り、pip install opencv-pythonを実行します.
Microsoft Windows [   10.0.17134.706]
(c) 2018 Microsoft Corporation。      。

C:\Users\LiuJing>D:

D:\>cd D:\Program Files\Python37\Scripts

D:\Program Files\Python37\Scripts>easy_install.exe pip
Searching for pip
Best match: pip 19.0.3
Adding pip 19.0.3 to easy-install.pth file
Installing pip-script.py script to d:\program files\python37\Scripts
Installing pip.exe script to d:\program files\python37\Scripts
Installing pip3-script.py script to d:\program files\python37\Scripts
Installing pip3.exe script to d:\program files\python37\Scripts
Installing pip3.7-script.py script to d:\program files\python37\Scripts
Installing pip3.7.exe script to d:\program files\python37\Scripts

Using d:\program files\python37\lib\site-packages
Processing dependencies for pip
Finished processing dependencies for pip

D:\Program Files\Python37\Scripts>pip install wheel
Collecting wheel
  Downloading https://files.pythonhosted.org/packages/96/ba/a4702cbb6a3a485239fbe9525443446203f00771af9ac000fa3ef2788201/wheel-0.33.1-py2.py3-none-any.whl
Installing collected packages: wheel
Successfully installed wheel-0.33.1
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

D:\Program Files\Python37\Scripts>pip install numpy
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/4e/9d/c129d78e6b942303b762ccfdf1f8339de80c5e6021b14ef0c99ec5bdc6aa/numpy-1.16.3-cp37-cp37m-win_amd64.whl (11.9MB)
    100% |████████████████████████████████| 11.9MB 197kB/s
Installing collected packages: numpy
Successfully installed numpy-1.16.3
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

D:\Program Files\Python37\Scripts>pip install opencv-python
Collecting opencv-python
  Downloading https://files.pythonhosted.org/packages/a3/50/04d0669afe884f137c2f490642756e8c4a658254300a9eaf253d1e643085/opencv_python-4.1.0.25-cp37-cp37m-win_amd64.whl (37.3MB)
    100% |████████████████████████████████| 37.4MB 150kB/s
Requirement already satisfied: numpy>=1.14.5 in d:\program files\python37\lib\site-packages (from opencv-python) (1.16.3)
Installing collected packages: opencv-python
Successfully installed opencv-python-4.1.0.25
You are using pip version 19.0.3, however version 19.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.

D:\Program Files\Python37\Scripts>
import cv2

img = cv2.imread("01.jpg")
cv2.imshow("1", img)
cv2.waitKey(10000)

画像をインポートして表示できれば成功