CPU:i7-4790k
显卡:GTX2060
Cuda 版本:11.3
Cunn版本: 11.6
Python版本:3.7.7
不想用anacoda,直接装 tensorflow
1.准备工作
- 安装python3.7.7(之前安装好的)
可以根据需要安装相应的版本,不建议安装最新版,python版本之间的代码兼容度不好。3.6~3.8可能比较合适。
我安装的是11.3版本。
deviceQuery.exe 和 bandwithTest.exe测试通过。
- 下载Tensorflow
我下载的是 tensorflow-2.9.1-cp37-cp37m-win_amd64.whl
- 安装组件
安装Tensorflow之前,安装好以下支持模块
A.Numpy: pip install numpy -i https://pypi.tuna.tsinghua.edu.cn/simple
B.mkl: pip install mkl -i https://pypi.tuna.tsinghua.edu.cn/simple
C.protobuf pip install protobuf -i https://pypi.tuna.tsinghua.edu.cn/simple
2.安装Tensorflow
把 tensorflow-2.9.1-cp37-cp37m-win_amd64.whl 放到d盘根目录,打开命令行并转到D:\
pip install tensorflow-2.9.1-cp37-cp37m-win_amd64.whl -i https://pypi.tuna.tsinghua.edu.cn/simple
当在安装过程中加载其他模块时,这将非常快。
[En]
This will be very fast when loading other modules during installation.
3.测试
import tensorflow as tf
print("Tensorflow version:")
print(tf.__version__)
print("CPU/GPU devices for Tensorflow:")
gpus = tf.config.experimental.list_physical_devices(device_type='GPU')
cpus = tf.config.experimental.list_physical_devices(device_type='CPU')
print(gpus)
print(cpus)
运行结果:
Tensorflow version:
2.9.1
CPU/GPU devices for Tensorflow:
[PhysicalDevice(name=’/physical_device:GPU:0′, device_type=’GPU’)]
[PhysicalDevice(name=’/physical_device:CPU:0′, device_type=’CPU’)]
至此安装完毕。
IDE可以使用Visual Studio Code(小规模测试)
或者Pycharm(程序较大很方便)
Original: https://blog.csdn.net/st01lsp/article/details/125294794
Author: st01lsp
Title: Tensorflow 2.9.1安装笔记
原创文章受到原创版权保护。转载请注明出处:https://www.johngo689.com/495965/
转载文章受原作者版权保护。转载请注明原作者出处!