1,安装adaconda
百度下载安装即可。
2,创建环境
更改源:
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/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/fastai/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/pytorch/
conda config --append channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/
# 搜索时显示通道地址
conda config --set show_channel_urls yes
adaconda 常用命令 :
xxx为环境名字,名字随意,但是后面需要用到
当前所处的环境,在命令的开始括号内如(tfgpu)
激活环境:conda activate xxx
创建环境:conda create -n xxx
安装软件:conda install xx
查看系统软件:conda list
conda create -n tfgpu
conda activate tfgpu
3,安装tensorflow gpu
安装gpu版本需要显卡支持,我的显卡为n卡 gtx 1070
官网下载cuda和cudnn,需要版本和显卡型号对应,还需和tensorflow版本对应。
我下载的
cuda_9.0.176_win10
cudnn-9.0-windows10-x64-v7.1
tensorflow安装的最新1.9.0
安装顺序,先安装cuda_9.0.176_win10
其中若是没有安装vs2015会出现问题,解决版本,勾选需要的内容即可(具体可以百度)
然后
解压cudnn ,把cuda下的bin,include,lib等文件复制到安装的cuda目录下,
我电脑目录(默认目录)C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
更改conda源为清华源(其他源可以自行百度)
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
复制执行就行
若是pip命令出现
q(问题):
Distributed 1.21.8 requires msgpack, which is not installed
执行命令
conda install -c anaconda msgpack-python
pip install msgpack
gpu版本安装:
pip install --ignore-installed --upgrade tensorflow-gpu -i https://pypi.tuna.tsinghua.edu.cn/simple
若是不出意外安装成功
然后可以安装其他的软件。
安装opencv-python命令
conda install --channel https://conda.anaconda.org/menpo opencv
###
conda install -c https://conda.anaconda.org/menpo opencv3 #安装opencv3
#如果要安装opencv4将opencv3改成如下命令
conda install -c https://conda.anaconda.org/menpo opencv #安装最新版opencv4
#也可通过conda search -c https://conda.anaconda.org/menpo opencv*来搜索所有opencv版本
注:安装opencv-python会改变python版本,需要仔细查看。版本依赖
pip 安装软件时执行时加上
临时
-i https://pypi.tuna.tsinghua.edu.cn/simple
pytorch:
conda install pytorch=1.2.0 torchvision cudatoolkit=10.0
keras:
anaconda show anaconda/keras-gpu
记录环境:
tf 1.13.1
pytorch 1.2.0
torchvision 0.4.0
opencv-python 4.2.0.34
keras-base 2.3.2
py3.6_cuda100_cudnn7_1
cudatoolkit=10.0.130
参考:
tensorflow(gpu)安装:https://blog.youkuaiyun.com/weixin_39290638/article/details/80045236
https://www.cnblogs.com/fanfzj/p/8521728.html
opencv-python安装:https://blog.youkuaiyun.com/lanchunhui/article/details/49717535
版本对照:https://blog.youkuaiyun.com/lifuxian1994/article/details/81103530
附加:cpu版本的直接运行命令
最好单独创建环境
conda install tensorflow 即可
---------------------
作者:dreamflywhere
来源:优快云
原文:https://blog.youkuaiyun.com/dreamFlyWhere/article/details/82804402?utm_source=copy
版权声明:本文为博主原创文章,转载请附上博文链接!