目录
查看显卡驱动版本
cmd进入终端
cd C:\Program Files\NVIDIA Corporation\NVSMI
nvidia-smi
安装cuda和cudnn
查看cuda版本:https://www.jianshu.com/p/d3b9419a0f89
查看安装cuda版本对应的驱动版本https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html
安装教程:https://blog.csdn.net/m0_37872216/article/details/103136477
安装anaconda
去下载安装anaconda:https://www.anaconda.com/download/
创建虚拟环境
创建虚拟环境:
conda create -n 环境名字 python=3.6 #指定python的安装版本为python3.6
更改国内下载源
更改国内下载源:
pip 国内源
更改 pip 源,可以让 pip 加速。在 user 目录中创建一个 pip 目录,如: C:\Users\xx\pip,xx是用户名,新建文件pip.ini(建议先新建成 .txt 文件,之后将后缀名改回),内容如下:
[global]
timeout = 6000
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
trusted-host = https://pypi.tuna.tsinghua.edu.cn
conda 国内源
如果 conda 命令执行很慢,可以更改 conda 源,让conda 加速。在cmd终端输入下列命令
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
运行以上两句,在c:\users\xx 目录下生成.condarc,xx表示用户名。.condarc 内容如下,表示成功:
channels:
https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
defaults
show_channel_urls: true
安装opencv
https://www.lfd.uci.edu/~gohlke/pythonlibs/
下载之后安装
或者:
pip install opencv-python
安装tensorflow
tensorflow-gpu版本对应:https://www.tensorflow.org/install/source_windows#gpu
检测是否安装成功:
import tensorflow as tf
print('Tensorflow Version:{}'.format(tf.__version__))
print(tf.test.is_gpu_available())
显示“GPU True”,即代表GPU版本安装成功!
如何查看当前tensorflow版本:
python
import tensorflow as tf
tf.version
查询tensorflow安装路径为:
tf.path
1、使用pip可以安装特定版本的tensorflow,比如
pip install tensorflow-gpu==1.7.0
2、升级到最新GPU版本
pip install --upgrade tensorflow-gpu
3、升级到最新CPU版本
pip install--upgrade tensorflow
4、如何降低自己的tensorflow版本?
pip install --upgrade tensorflow-gpu==1.1.0
安装pytorch
官网下载:https://pytorch.org/
根据官网给的命令下载安装。
怎么查看pytorch安装成功:
运行以下命令
import torch
x = torch.rand(5,5)
print(x)
输出类似下面内容,则pytorch安装成功
再执行
torch.cuda.is_available()
如果返回True,GPU版Pytorch成功安装完毕