赞
踩
先鼠标右键查看对应的CUDA的版本:
根据本机的CUDA、cuDNN版本确定python及TensorFlow版本。如下表所示:
tensorflow_gpu版本 Python 版本 cuDNN CUDA
tensorflow_gpu-2.4.0 3.6-3.8 8.0 11.0
tensorflow_gpu-2.3.0 3.5-3.8 7.6 10.1
tensorflow_gpu-2.2.0 3.5-3.8 7.6 10.1
tensorflow_gpu-2.1.0 3.5-3.7 7.6 10.1
tensorflow_gpu-2.0.0 3.5-3.7 7.4 10
tensorflow_gpu-1.15.0 3.5-3.7 7.4 10
tensorflow_gpu-1.14.0 3.5-3.7 7.4 10
tensorflow_gpu-1.13.0 3.5-3.7 7.4 10
tensorflow_gpu-1.12.0 3.5-3.6 7 9
tensorflow_gpu-1.11.0 3.5-3.6 7 9
tensorflow_gpu-1.10.0 3.5-3.6 7 9
tensorflow_gpu-1.9.0 3.5-3.6 7 9
tensorflow_gpu-1.8.0 3.5-3.6 7 9
tensorflow_gpu-1.7.0 3.5-3.6 7 9
tensorflow_gpu-1.6.0 3.5-3.6 7 9
tensorflow_gpu-1.5.0 3.5-3.6 7 9
tensorflow_gpu-1.4.0 3.5-3.6 6 8
tensorflow_gpu-1.3.0 3.5-3.6 6 8
tensorflow_gpu-1.2.0 3.5-3.6 5.1 8
tensorflow_gpu-1.1.0 3.5 5.1 8
tensorflow_gpu-1.0.0 3.5 5.1 8
我的CUDA版本是9 所以只能选择对应9 的版本进行安装
解压:解压包显示内容
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- conda config --set show_channel_urls yes
- conda create -n tensorflow-gpu python=3.6.5
-
You will need to adjust your conda configuration to proceed. Use `conda config --show channels` to view your configuration's current state, and use `conda config --show-sources` to view config file locations.
conda config --remove-key channels
- conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
- conda config --set show_channel_urls yes
- conda create -n tensorflow-gpu python=3.6.5
-
(1)点击y:上面环境出现y/no: 直接点y出现下面的结果:
python -m pip install --upgrade pip
pip3 install -i https://pypi.tuna.tsinghua.edu.cn/simple/ --upgrade tensorflow-gpu==1.9
- import tensorflow as tf
- a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
- b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
- c = tf.matmul(a, b)
- sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
- print(sess.run(c))
- import tensorflow as tf
- tf.compat.v1.disable_eager_execution()
- a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a')
- b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b')
- c = tf.matmul(a, b)
- sess= tf.compat.v1.Session(config=tf.compat.v1.ConfigProto(log_device_placement=True))
- print(sess.run(c))
activate tensorflow-gpu
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。