同时在Anaconda上使用Tensorlfow和OpenCV可能会出现一些版本问题,我把以前写的能够走得通的流程分享一下。
一、安装环境
Anaconda+CUDA10.0+CUDNN7.5.0;
二、配置Anaconda镜像源
直接打开控制台输入:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
注:创建新环境后如果出现HTTP0错误:
打开:
C:\Users<你的用户名> 下的.condarc
改成:
channels:
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
- http://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
ssl_verify: true
show_channel_urls: true
三、创建新环境
打开控制台,依次输入以下指令:
conda create -n python36 python=3.6
activate python36
conda install tensorflow-gpu=1.13
conda install scikit-image
conda install matplotlib
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple opencv-python
注:运行代码后出现 AttributeError: type object ‘h5py.h5r.Reference’ has no attribute ‘reduce_cython’ 错误:
这是h5py库版本不兼容引起的,输入以下指令即可:
activate python36
conda install h5py=2.8.0