Reputation: 111
I am currently studying Pytorch and trying to use the cv2
module. I am using Jupyter notebook and Windows.
I have installed opencv
like this:
!pip install opencv-python
When I choose the kernel (by change kernel option) Python3
and import cv2
then there is no problem.
But when I choose the kernel Pytorch
and import cv2
, then there is an error:
ModuleNotFoundError: No module named 'cv2'
This must be a basic question but I can't find out what the problem is.
Upvotes: 0
Views: 5101
Reputation: 17
If you run pip install opencv
failed. You can download the whl
file in
here and then install it locally:
pip install opencv_python-4.5.5.64-cp36-abi3-win_amd64.whl
Upvotes: -1
Reputation: 63
I found the answer to this problem here:
First do run these commands
$ conda update anaconda-navigator
$ conda update navigator-updater
then the issue for the instruction below will be resolved
For windows if you have anaconda
installed, you can simply do:
pip install opencv-python
or
conda install -c https://conda.binstar.org/menpo opencv
If you're on linux you can do :
pip install opencv-python
or
conda install opencv
Upvotes: 4