在terminal中输入conda install opencv-python
出现PackagesNotFoundError。
PS C:\develop\python_workspace\learn_pytorch> conda install opencv-python
Collecting package metadata (current_repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
Collecting package metadata (repodata.json): done
Solving environment: failed with initial frozen solve. Retrying with flexible solve.
PackagesNotFoundError: The following packages are not available from current channels:
- opencv-python
Current channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/win-64
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/win-64
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/noarch
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/win-64
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/noarch
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/win-64
需要指定以下Current channels中的镜像路径进行下载
这里指定豆瓣镜像 -i 进行安装
输入下面命令
pip install opencv-python==4.5.1.48 -i https://pypi.douban.com/simple
安装成功。
PS C:\develop\python_workspace\learn_pytorch> pip install opencv-python==4.5.1.48 matplo
tlib -i https://pypi.douban.com/simple
Looking in indexes: https://pypi.douban.com/simple
Collecting opencv-python==4.5.1.48
Downloading https://mirrors.cloud.tencent.com/pypi/packages/3d/ae/9d9ea53f6e0288bbb494
e22f0cd73f3f9ac2ea1b9a1b7889ccc1ceaa3c1f/opencv_python-4.5.1.48-cp39-cp39-win_amd64.whl
(34.9 MB)
|████████████████████████████████| 34.9 MB 1.1 MB/s
Requirement already satisfied: matplotlib in c:\develop\anaconda3\lib\site-packages (3.5
.1)
Requirement already satisfied: numpy>=1.19.3 in c:\develop\anaconda3\lib\site-packages (
from opencv-python==4.5.1.48) (1.19.5)
Requirement already satisfied: pyparsing>=2.2.1 in c:\develop\anaconda3\lib\site-package
s (from matplotlib) (3.0.4)
Requirement already satisfied: packaging>=20.0 in c:\develop\anaconda3\lib\site-packages
(from matplotlib) (21.3)
Requirement already satisfied: kiwisolver>=1.0.1 in c:\develop\anaconda3\lib\site-packag
es (from matplotlib) (1.3.2)
Requirement already satisfied: cycler>=0.10 in c:\develop\anaconda3\lib\site-packages (f
rom matplotlib) (0.11.0)
Requirement already satisfied: fonttools>=4.22.0 in c:\develop\anaconda3\lib\site-packag
es (from matplotlib) (4.25.0)
Requirement already satisfied: python-dateutil>=2.7 in c:\develop\anaconda3\lib\site-pac
kages (from matplotlib) (2.8.2)
Requirement already satisfied: pillow>=6.2.0 in c:\develop\anaconda3\lib\site-packages (
from matplotlib) (9.0.1)
Requirement already satisfied: six>=1.5 in c:\develop\anaconda3\lib\site-packages (from
python-dateutil>=2.7->matplotlib) (1.16.0)
Installing collected packages: opencv-python
Attempting uninstall: opencv-python
Found existing installation: opencv-python 4.5.5.64
Uninstalling opencv-python-4.5.5.64:
Successfully uninstalled opencv-python-4.5.5.64
Successfully installed opencv-python-4.5.1.48
PS C:\develop\python_workspace\learn_pytorch>