Windows安装TensorFlow-Docker Installation of TensorFlow on Windows

时间:2022-06-14 13:06:16

TensorFlow是Google开发的进行Deep Learning的包,目前只是支持在Linux和OSX上运行。不过这个秋季或许就有支持Windows的版本出现了,那么对于使用Windows的开发人员呢,想用TensorFlow也不必等到秋季或转到Linux和OSX系统。在Windows上运行有两种方式,一种是安装虚拟机并且安装Ubuntu系统,在Ubuntu系统上安装TensorFlow,具体步骤可以在Google官网上找到:https://www.tensorflow.org/versions/r0.8/get_started/os_setup.html#pip-installation。另外一种方式是用Docker来安装。下面我就分享一下我用Docker安装TensorFlow的经验。以下采用Chinglish,并非搬运,但也简单易读。

One can always install TensorFlow on Ubuntu in a virtual machine if you are using Windows. Alternatively, you can also choose Docker-Installation.

1. Install Docker From:

https://www.docker.com/products/docker-toolbox

I recommend you install Git for Windows and Oracle VM VirtualBox independently, and thus you just need to click "next". Git for windowns can be accessed at https://git-for-windows.github.io/ amd Oracle VirtualBox can be downloaded at: https://www.virtualbox.org/.

2. Open Docker Quickstart Terminal

It will run pre-create checks and one may need to enable "Visualization" in BIOS if it is not. Then you will see the cute whale.

Windows安装TensorFlow-Docker Installation of TensorFlow on Windows

Sometimes, you may need to regenerate certifications, otherwise you will find error information after the virtual machine. It happened to me, to regenerate the certifications you need to type:

$docker-machine regenerate-certs default

To generate a new virtual machine called "vdocker", you can type:

$docker-machine create vdocker -d virtualbox

Now you can check the running virtual machine by typing:

$docker-machine ls

Windows安装TensorFlow-Docker Installation of TensorFlow on Windows

Or in Virtual Box you will see:

Windows安装TensorFlow-Docker Installation of TensorFlow on Windows

If you see the running virtual machine, then you can go to the next step to install TensorFlow

3. Install TensorFlow

Open a cmd, rather than Docker Terminal,

type

>FOR /f "tokens=*" %i IN ('docker-machine env --shell cmd vdocker') DO %i

Windows安装TensorFlow-Docker Installation of TensorFlow on Windows

Then install TensorFlow:

>docker run -it -p : b.gcr.io/tensorflow/tensorflow

4. Open chrome and go to Open chrome and go to http://192.168.99.***:8888/

You need change the IP according to your case. Then you open the Jupyter and try your first deep learning example.

Windows安装TensorFlow-Docker Installation of TensorFlow on Windows

It will give you W is about 0.1 and b is about 0.3:

Windows安装TensorFlow-Docker Installation of TensorFlow on Windows

Enjoy TensorFlow and explore more on deep learning on your own!

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

原创内容,未经许可,不需转载!