深度学习(Windows)环境配置相关(复习留用)
前前后后也装了许多次tensorflow-gpu,算是对深度学习环境配置有了很大的了解。在网上看到一些划算不错的博文,尽管可能会有一些出入,但是大体是通的。把一些链接地址放在这里,以供接下来自己调用。
-
anaconda pkgs 离线安装教程 点击链接 (适用于channels命令行界面下载捉急而言)
-
tensorflow-gpu环境配置方法 点击链接 (anaconda 安装直接将python加入环境变量即可)
-
cuda nvidia官方下载地址 点击链接
-
cudnn nvidia官方下载地址 点击链接 (需要登录,可 Login with your social account—>Wechat)
实际上可以直接采用conda install tensorflow-gpu的方式,conda会配合安装cudnn和cudatoolkit。无需上述cuda和cudnn的官网下载过程。这样,借助镜像源,时间经济成本会大大降低。
-
cudnn、cuda版等版本对应关系 点击链接
-
pip install xx和conda install xx 对比 点击链接(建议采用conda install统一进行安装操作。可自动添加依赖pkgs,并且方便pkgs管理)
conda 相关命令行指令 :
conda instal xx # 安装pkgs
conda activate #激活base环境
conda create -n tensorflow-gpu python=3.6 # conda create --name [虚拟环境名] [python的版本] [需要的包]
conda env list # 列出所有虚拟环境
conda list --name # 查看指定环境下的pkgs list
activate tensorflow-gpu # 激活名为tensorflow-gpu的虚拟环境
镜像源问题:
# 添加镜像源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://pypi.tuna.tsinghua.edu.cn/simple
# 移除镜像源
conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/
conda config --show channels # 查看所有channels
conda config --remove-key channels # 恢复默认channels
conda config --set show_channel_urls yes # 从channels中安装包时显示channels的url地址
pip install --index https://pypi.mirrors.ustc.edu.cn/simple/ opencv-python #cv2