zoukankan      html  css  js  c++  java
  • Windows下使用TensorFlow

    上一篇日志(http://www.cnblogs.com/huidong/p/5426556.html)写了如何在Windows下安装Docker,并且在VM上安装TensorFlow。

    在Window下每次启动TensorFlow略麻烦,就是每次都要保证启动VM。比如我的VM的名字叫vdocker,那么启动它并且regenerate证书需要用。

    $docker-machine start vdocker
    $docker-machine regenerate-certs vdocker

    检查VM是否正常运行可以用

    $docker-machine ls

    注意,以上都是在Docker Terminal下完成的。

    VM启动后,再进入到cmd中,

    >FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd vdocker') DO %i
    >docker run -it -p 8888:8888 b.gcr.io/tensorflow/tensorflow

    一个都不能少,然后在使用Jupyter跑你的Python程序。

    由于TensorFlow还没有原生态支持Windows,所以在windows下使用TensorFlow没有像OSX下那么直接。好在楼主手上有小白和小黑(小黑主要用来做科研,跑MATLAB,COMSOL等等),在Macbook上,如果安装TensorFlow官网安装完TensorFlow后(我选用了Anaconda Installation),只需在Terminal中键入:

    wireless-10-145-60-151:~ Hui$ source activate tensorflow
    discarding /Users/hui/anaconda/bin from PATH
    prepending /Users/hui/anaconda/envs/tensorflow/bin to PATH
    (tensorflow)wireless-10-145-60-151:~ Hui$ python -V
    Python 2.7.11 :: Continuum Analytics, Inc.
    (tensorflow)wireless-10-145-60-151:~ Hui$ python
    Python 2.7.11 |Continuum Analytics, Inc.| (default, Dec  6 2015, 18:57:58) 
    [GCC 4.2.1 (Apple Inc. build 5577)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    Anaconda is brought to you by Continuum Analytics.
    Please check out: http://continuum.io/thanks and https://anaconda.org
    >>> import tensorflow as tf
    >>> 
    (tensorflow)wireless-10-145-60-151:~ Hui$ source deactivate
    discarding /Users/hui/anaconda/envs/tensorflow/bin from PATH
    wireless-10-145-60-151:~ Hui$ 

    可以发现在Python中import tensorflow完全没有问题。楼主计划在几天内更新Macbook安装TensorFlow的方法,其实相当简单,基本就是官网的步骤。

    By 董辉(ECE@德克萨斯大学Austin分校)

  • 相关阅读:
    bootstrapValidator重新校验/全选回显
    mybatis遍历map参数查询
    location.href传json字符串
    springmvc异步处理
    intellIJ IDEA学习笔记3
    intellIJ IDEA学习笔记2
    intellIJ IDEA学习笔记
    maven国内镜像
    Docker版本Jenkins的使用
    Docker容器网络
  • 原文地址:https://www.cnblogs.com/huidong/p/5429216.html
Copyright © 2011-2022 走看看