Follow me

AI(Artificial Intelligence)study之TensorFlow(1)【zoues.com】
三月 30, 2017|DockerPaaS

AI(Artificial Intelligence)study之TensorFlow(1)【zoues.com】

AI(Artificial Intelligence)study之TensorFlow(1)【zoues.com】



AI(Artificial Intelligence)study之TensorFlow(1)



Download and Setup

You can install TensorFlow either from our provided binary packages or from the github source.


The TensorFlow Python API supports Python 2.7 and Python 3.3+.

The GPU version works best with Cuda Toolkit 8.0 and cuDNN v5. Other versions are supported (Cuda toolkit >= 7.0 and cuDNN >= v3) only when installing from sources. Please see Cuda installation for details. For Mac OS X, please see Setup GPU for Mac.

Cuda很大,要1.2G。 cuDNN需要在developer.nvidia.com免费注册。Python 很简单,直接到官网下载最新版本就可。


We support different ways to install TensorFlow:

  • Pip install: Install TensorFlow on your machine, possibly upgrading previously installed Python packages. May impact existing Python programs on your machine.

  • Virtualenv install: Install TensorFlow in its own directory, not impacting any existing Python programs on your machine.

  • Anaconda install: Install TensorFlow in its own environment for those running the Anaconda Python distribution. Does not impact existing Python programs on your machine.

  • Docker install: Run TensorFlow in a Docker container isolated from all other programs on your machine.

  • Installing from sources: Install TensorFlow by building a pip wheel that you then install using pip.

If you are familiar with Pip, Virtualenv, Anaconda, or Docker, please feel free to adapt the instructions to your particular needs. The names of the pip and Docker images are listed in the corresponding installation sections.

If you encounter installation errors, see common problems for some solutions.

Pip installation on Windows

TensorFlow supports only 64-bit Python 3.5 on Windows. We have tested the pip packages with the following distributions of Python:

  • Python 3.5 from Anaconda

  • Python 3.5 from python.org.

    NOTE: TensorFlow requires MSVCP140.DLL, which may not be installed on your system. If, when you import tensorflow as tf, you see an error about No module named "_pywrap_tensorflow" and/or DLL load failed, check whether MSVCP140.DLL is in your %PATH% and, if not, you should install the Visual C++ 2015 redistributable (x64 version).

Both distributions include pip. To install the CPU-only version of TensorFlow, enter the following command at a command prompt:

C:/> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/cpu/tensorflow-0.12.0rc1-cp35-cp35m-win_amd64.whl

To install the GPU version of TensorFlow, enter the following command at a command prompt:

C:/> pip install --upgrade https://storage.googleapis.com/tensorflow/windows/gpu/tensorflow_gpu-0.12.0rc1-cp35-cp35m-win_amd64.whl

选择pip安装就可,别的方法没研究。目前还没有GPU,所以选择安装CPU-only version。

选择“开始”-“cmd”-然后运行pip install 那段命令。然后开始安装,安装好的界面如下所示。

AI(Artificial Intelligence)study之TensorFlow(1)

You can now test your installation.

Run TensorFlow from the Command Line

Open a terminal and type the following:

$ python ... >>> import tensorflow as tf >>> hello = tf.constant('Hello, TensorFlow!') >>> sess = tf.Session() >>> print(sess.run(hello)) Hello, TensorFlow! >>> a = tf.constant(10) >>> b = tf.constant(32) >>> print(sess.run(a + b)) 42 >>>


to be continued.未完待续。


no comments