Anaconda、Cuda、CuDnn、PyTorch、TensorFlow、Keras安装

1.安装PyTorch流程参考:
https://www.cnblogs.com/zhouzhiyao/p/11784055.html
https://blog.csdn.net/qq_23013309/article/details/103965619

2.Anaconda下载
https://www.anaconda.com/products/individual#Downloads

3.查询Cuda版本
https://docs.nvidia.com/cuda/cuda-toolkit-release-notes/index.html

4.Cuda下载
https://developer.nvidia.com/cuda-10.0-download-archive

5.Cudnn下载,需要登录,QQ就行
https://developer.nvidia.com/cudnn-download-survey
https://developer.nvidia.com/rdp/cudnn-download

6.下载PyTorch
https://download.pytorch.org/whl/torch_stable.html

7.验证PyTorch
import torch
print(“torch version {}”.format(torch.version))
print(“cuda si available {}”.format(torch.cuda.is_available()))
运行结果:
torch version 1.7.1+cu101
cuda si available True

8.安装TensorFlow参考流程:
https://zhuanlan.zhihu.com/p/95065951

9.创建tensorflow环境
conda create -n tensorflow-gpu python=3.8.5
激活环境
activate tensorflow-gpu

10.下载tensorflow ~.whl文件
https://pypi.org/project/tensorflow/#files

11.进入cmd安装.whl文件

12.进入JupyterLab测试
报错:“no module named tensorflow”

13.在tensorflow环境下conda install tensorflow,安装tensorflow numpy等包
https://blog.csdn.net/xiakejiang/article/details/82720815

14.测试
报错:module ‘tensorflow’ has no attribute ‘Session’

15.修改参考:
https://blog.csdn.net/sinat_36502563/article/details/102302392
https://blog.csdn.net/weixin_38410551/article/details/103631977
改成:
import tensorflow as tf
tf.compat.v1.disable_eager_execution()
hello = tf.constant(‘hello,tensorflow’)
sess= tf.compat.v1.Session()
print(sess.run(hello))
运行结果:
b’hello,tensorflow’

明天起来安装Keras。

你可能感兴趣的:(tensorflow,pytorch)