Windows下使用TensorFlow

來源:互聯網
上載者:User

標籤:

上一篇日誌(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 tensorflowdiscarding /Users/hui/anaconda/bin from PATHprepending /Users/hui/anaconda/envs/tensorflow/bin to PATH(tensorflow)wireless-10-145-60-151:~ Hui$ python -VPython 2.7.11 :: Continuum Analytics, Inc.(tensorflow)wireless-10-145-60-151:~ Hui$ pythonPython 2.7.11 |Continuum Analytics, Inc.| (default, Dec  6 2015, 18:57:58) [GCC 4.2.1 (Apple Inc. build 5577)] on darwinType "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 deactivatediscarding /Users/hui/anaconda/envs/tensorflow/bin from PATHwireless-10-145-60-151:~ Hui$ 

可以發現在Python中import tensorflow完全沒有問題。樓主計劃在幾天內更新Macbook安裝TensorFlow的方法,其實相當簡單,基本就是官網的步驟。

Windows下使用TensorFlow

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.