TensorFlow-安装 (TensorFlow - Installation)
To install TensorFlow, it is important to have “Python” installed in your system. Python version 3.4+ is considered the best to start with TensorFlow installation.
要安装TensorFlow,在系统中安装“ Python”非常重要。 从TensorFlow安装开始,Python 3.4+被认为是最好的选择。
Consider the following steps to install TensorFlow in Windows operating system.
考虑以下步骤在Windows操作系统中安装TensorFlow。
Step 1 − Verify the python version being installed.
步骤1-验证正在安装的python版本。
![Python Version Installed](https://i-blog.csdnimg.cn/blog_migrate/5c113e510f176cccc125cbabbba0ad60.png)
Step 2 − A user can pick up any mechanism to install TensorFlow in the system. We recommend “pip” and “Anaconda”. Pip is a command used for executing and installing modules in Python.
步骤2-用户可以选择任何机制在系统中安装TensorFlow。 我们建议使用“点子”和“ Anaconda”。 Pip是用于在Python中执行和安装模块的命令。
Before we install TensorFlow, we need to install Anaconda framework in our system.
在安装TensorFlow之前,我们需要在系统中安装Anaconda框架。
![Install Anaconda](https://i-blog.csdnimg.cn/blog_migrate/6fa2ac674f5ad2b6ae8285f475560362.png)
After successful installation, check in command prompt through “conda” command. The execution of command is displayed below −
成功安装后,通过“ conda”命令检入命令提示符。 命令的执行如下所示-
![Conda Command Execution](https://i-blog.csdnimg.cn/blog_migrate/9df9797253cdec30c42fc89a2c1a57d7.png)
Step 3 − Execute the following command to initialize the installation of TensorFlow −
步骤3-执行以下命令以初始化TensorFlow的安装-
conda create --name tensorflow python = 3.5
![Installation of TensorFlow](https://i-blog.csdnimg.cn/blog_migrate/fc40400e23024d9230889bfb8a992546.png)
It downloads the necessary packages needed for TensorFlow setup.
它下载TensorFlow设置所需的必要软件包。
Step 4 − After successful environmental setup, it is important to activate TensorFlow module.
步骤4-成功设置环境后,激活TensorFlow模块很重要。
activate tensorflow
![Environmental Setup](https://i-blog.csdnimg.cn/blog_migrate/837874150e7ea7d4ccbd1d4b2a605067.png)
Step 5 − Use pip to install “Tensorflow” in the system. The command used for installation is mentioned as below −
步骤5-使用pip在系统中安装“ Tensorflow”。 用于安装的命令如下所述-
pip install tensorflow
And,
和,
pip install tensorflow-gpu
![Pip To Install](https://i-blog.csdnimg.cn/blog_migrate/5132fff5bf608fc7b8b450f745022661.png)
![Pip To Install TensorFlow](https://i-blog.csdnimg.cn/blog_migrate/4096a2c57d81f8807e5501c0c2a4f3dd.png)
After successful installation, it is important to know the sample program execution of TensorFlow.
成功安装后,了解TensorFlow的示例程序执行非常重要。
Following example helps us understand the basic program creation “Hello World” in TensorFlow.
以下示例可帮助我们了解TensorFlow中的基本程序创建“ Hello World”。
![Hello World Example](https://i-blog.csdnimg.cn/blog_migrate/384d949c0d661802c74a65596342efec.png)
The code for first program implementation is mentioned below −
下面提到了第一个程序实现的代码-
>> activate tensorflow
>> python (activating python shell)
>> import tensorflow as tf
>> hello = tf.constant(‘Hello, Tensorflow!’)
>> sess = tf.Session()
>> print(sess.run(hello))
翻译自: https://www.tutorialspoint.com/tensorflow/tensorflow_installation.htm