Ayush Basak
Ayush Basak

Reputation: 469

I can't install opencv for python on Windows after trying out almost everything

These are the things I tried but nothing seems to work yet

pip install opencv-python

OR

python -m pip install opencv-python

gives an error

ERROR: Could not find a version that satisfies the requirement opencv-python (from versions: none) ERROR: No matching distribution found for opencv-python

I downloaded the opencv windows package from the site and copied the PYD file into python's site-packages but still cv2 cannot be imported

import cv2

gives an error as

DLL load failed while importing cv2: %1 is not a valid Win32 application.

Then I downloaded the opecv-control WHL file for python3.8/32bit (as my python is 32 bit) unofficial Binaries for python extension packages and followed the step but still nothing happened

I am a beginner in this.

Upvotes: 2

Views: 12165

Answers (4)

Jeyasuriya Natarajan
Jeyasuriya Natarajan

Reputation: 10

Python Package Link

In the above link search opencv_python‑4.1.2‑cp36‑cp36m‑win_amd64.whl for python 3.6 64 bit and download that wheel file.

Install procedures:

  1. Go to the site-package path in the python36

    C:\Program Files\Python36\Lib\site-packages>

  2. Then put the command pip install . Example,

    C:\Program Files\Python36\Lib\site-packages>pip install F:\urllib3-1.25.7-py2.py3-none-any.whl

After this procedure import and check in IDLE.

If any doubt ping this. Good luck

Upvotes: 0

ArunJose
ArunJose

Reputation: 2174

OpenCV hasn't been built for 3.8 yet according to the docs 3.7 is the highest version

https://pypi.org/project/opencv-python/

try downgrading your python to 3.7 or below. It would work.

Upvotes: 4

Braden Shipley
Braden Shipley

Reputation: 25

Is pip up to date? You can run python -m pip install --upgrade pip to check. It should work after that.

Upvotes: 1

alexisdevarennes
alexisdevarennes

Reputation: 5642

Please try the following:

import imp
imp.find_module("cv2")

Upvotes: 0

Related Questions