【Anaconda安装包】如何在Ananconda环境下安装CV2(opencv)

python3 下的opencv:

环境:Anaconda == 3      python == 3.x

安装库: 

conda install -c menpo opencv

安装完之后更新源:

python -m pip install --upgrade pip

如果不行,可使用以下官网给到的方法:

 

Step 1: Install Anaconda (a python distribution)

Download and install Anaconda 64-bit version from https://www.anaconda.com/

It is advised to install Anaconda for Python 3.

Step 2 : Create Virtual Environment

Open the command prompt and execute the following command.

conda create --name opencv-env python=3.6

You should get an output as shown below:

Step 3 : Install OpenCV

3.1. Activate the environment

1

2

# See how the (opencv-env) appears before the prompt after this command.

activate opencv-env

3.2. Install OpenCV and other important packages

Continuing from the above prompt, execute the following commands

去清华镜像网站,搜索网址,下载对应的opencv库版本,:

https://pypi.tuna.tsinghua.edu.cn/simple/opencv-python
下载:
opencv_python-4.2.0.34-cp36-cp36m-win_amd64.whl
下载之后将xxx.whl包复制放在Anaconda3\envs\opencv-env\Lib\site-packages里面
# 管理员prompt中,进入环境

activate opencv-env

cd C:\ProgramData\Anaconda3\envs\opencv-env\Lib\site-packages

python -m pip install -U --force-reinstall pip

pip install .\opencv_python-4.2.0.34-cp36-cp36m-win_amd64.whl
1 pip install numpy scipy matplotlib scikit-learn jupyter
2 pip install opencv-contrib-python
3 pip install dlib

3.3. Test your installation

Open the python prompt on the command line by typing python on the command prompt

1

2

3

4

import cv2

cv2.__version__

import dlib

dlib.__version__

done !

 

https://www.learnopencv.com/install-opencv-3-and-dlib-on-windows-python-only/

 

你可能感兴趣的:(OpenCV,计算机视觉)