windows 10 anaconda python 3.7 安装keras-gpu tensorflow-gpu

我的个人博客:zhang0peter的个人博客


win 10 anaconda python3.7 安装keras tensorflow-gpu

pytorch的安装参考这篇文章:windows anaconda python 3.7 安装 pytorch-gpu

2019-6-1:清华更新源已经关闭了
先添加清华源:


进入安装:

conda install keras-gpu

注意:在安装keras-gpu的时候一般会顺便把tensorflow-gpu也安装了,所以不需要额外安装tensorflow-gpu

WARNING: The conda.compat module is deprecated and will be removed in a future release.
Collecting package metadata: done
Solving environment: done

## Package Plan ##

  environment location: C:\Users\peter\Anaconda3

  added / updated specs:
    - keras-gpu


The following packages will be downloaded:

    package                    |            build
    ---------------------------|-----------------
    _tflow_select-2.1.0        |              gpu           3 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    absl-py-0.7.0              |           py37_0         157 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    astor-0.7.1                |           py37_0          44 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ca-certificates-2019.1.23  |                0         158 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    certifi-2019.3.9           |           py37_0         155 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    conda-4.6.11               |           py37_0         1.7 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cudatoolkit-10.0.130       |                0       371.0 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    cudnn-7.3.1                |       cuda10.0_0       199.1 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    gast-0.2.2                 |           py37_0         138 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    grpcio-1.16.1              |   py37h351948d_1         947 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    keras-applications-1.0.7   |             py_0          33 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    keras-base-2.2.4           |           py37_0         489 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    keras-gpu-2.2.4            |                0           5 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    keras-preprocessing-1.0.9  |             py_0          35 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    libprotobuf-3.6.1          |       h7bd577a_0         1.9 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    markdown-3.0.1             |           py37_0         125 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    mock-2.0.0                 |           py37_0         104 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    openssl-1.1.1b             |       he774522_1         5.7 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    pbr-5.1.3                  |             py_0          74 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    protobuf-3.6.1             |   py37h33f27b4_0         514 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorboard-1.13.1         |   py37h33f27b4_0         3.3 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-1.13.1          |gpu_py37h83e5d6a_0           4 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-base-1.13.1     |gpu_py37h871c8ca_0       218.5 MB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-estimator-1.13.0|             py_0         205 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    tensorflow-gpu-1.13.1      |       h0d30ee6_0           2 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    termcolor-1.1.0            |           py37_1           7 KB  https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
    ------------------------------------------------------------
                                           Total:       804.4 MB

The following NEW packages will be INSTALLED:

  _tflow_select      anaconda/pkgs/main/win-64::_tflow_select-2.1.0-gpu
  absl-py            anaconda/pkgs/main/win-64::absl-py-0.7.0-py37_0
  astor              anaconda/pkgs/main/win-64::astor-0.7.1-py37_0
  cudatoolkit        anaconda/pkgs/main/win-64::cudatoolkit-10.0.130-0
  cudnn              anaconda/pkgs/main/win-64::cudnn-7.3.1-cuda10.0_0
  gast               anaconda/pkgs/main/win-64::gast-0.2.2-py37_0
  grpcio             anaconda/pkgs/main/win-64::grpcio-1.16.1-py37h351948d_1
  keras-applications anaconda/pkgs/main/noarch::keras-applications-1.0.7-py_0
  keras-base         anaconda/pkgs/main/win-64::keras-base-2.2.4-py37_0
  keras-gpu          anaconda/pkgs/main/win-64::keras-gpu-2.2.4-0
  keras-preprocessi~ anaconda/pkgs/main/noarch::keras-preprocessing-1.0.9-py_0
  libprotobuf        anaconda/pkgs/main/win-64::libprotobuf-3.6.1-h7bd577a_0
  markdown           anaconda/pkgs/main/win-64::markdown-3.0.1-py37_0
  mock               anaconda/pkgs/main/win-64::mock-2.0.0-py37_0
  pbr                anaconda/pkgs/main/noarch::pbr-5.1.3-py_0
  protobuf           anaconda/pkgs/main/win-64::protobuf-3.6.1-py37h33f27b4_0
  tensorboard        anaconda/pkgs/main/win-64::tensorboard-1.13.1-py37h33f27b4_0
  tensorflow         anaconda/pkgs/main/win-64::tensorflow-1.13.1-gpu_py37h83e5d6a_0
  tensorflow-base    anaconda/pkgs/main/win-64::tensorflow-base-1.13.1-gpu_py37h871c8ca_0
  tensorflow-estima~ anaconda/pkgs/main/noarch::tensorflow-estimator-1.13.0-py_0
  tensorflow-gpu     anaconda/pkgs/main/win-64::tensorflow-gpu-1.13.1-h0d30ee6_0
  termcolor          anaconda/pkgs/main/win-64::termcolor-1.1.0-py37_1

The following packages will be SUPERSEDED by a higher-priority channel:

  ca-certificates                                 pkgs/main --> anaconda/pkgs/main
  certifi                                         pkgs/main --> anaconda/pkgs/main
  conda                                           pkgs/main --> anaconda/pkgs/main
  openssl                                         pkgs/main --> anaconda/pkgs/main


Proceed ([y]/n)?

测试:

import tensorflow as tf
# Creates a graph.
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)
# Creates a session with log_device_placement set to True.
sess = tf.Session(config=tf.ConfigProto(log_device_placement=True))
# Runs the op.
print(sess.run(c))

结果如下:

2019-04-09 09:43:51.546292: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019-04-09 09:43:51.774686: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties:
name: GeForce GTX 960M major: 5 minor: 0 memoryClockRate(GHz): 1.176
pciBusID: 0000:01:00.0
totalMemory: 4.00GiB freeMemory: 3.34GiB
2019-04-09 09:43:51.785557: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-04-09 09:43:53.083262: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-09 09:43:53.092130: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0
2019-04-09 09:43:53.096845: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N
2019-04-09 09:43:53.102709: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 3050 MB memory) -> physical GPU (device: 0, name: GeForce GTX 960M, pci bus id: 0000:01:00.0, compute capability: 5.0)
Device mapping:
/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 960M, pci bus id: 0000:01:00.0, compute capability: 5.0
2019-04-09 09:43:53.121080: I tensorflow/core/common_runtime/direct_session.cc:317] Device mapping:
/job:localhost/replica:0/task:0/device:GPU:0 -> device: 0, name: GeForce GTX 960M, pci bus id: 0000:01:00.0, compute capability: 5.0

MatMul: (MatMul): /job:localhost/replica:0/task:0/device:GPU:0
2019-04-09 09:43:53.134660: I tensorflow/core/common_runtime/placer.cc:1059] MatMul: (MatMul)/job:localhost/replica:0/task:0/device:GPU:0
a: (Const): /job:localhost/replica:0/task:0/device:GPU:0
2019-04-09 09:43:53.141017: I tensorflow/core/common_runtime/placer.cc:1059] a: (Const)/job:localhost/replica:0/task:0/device:GPU:0
b: (Const): /job:localhost/replica:0/task:0/device:GPU:0
2019-04-09 09:43:53.149598: I tensorflow/core/common_runtime/placer.cc:1059] b: (Const)/job:localhost/replica:0/task:0/device:GPU:0
[[22. 28.]
 [49. 64.]]

安装完成

展开阅读全文

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 编程工作室 设计师: CSDN官方博客
应支付0元
点击重新获取
扫码支付

支付成功即可阅读