Python Deep Learning 简明教程
Python Deep Learning - Environment
在本章中,我们将了解 Python 深度学习的环境设置。我们必须安装以下软件来制作深度学习算法。
In this chapter, we will learn about the environment set up for Python Deep Learning. We have to install the following software for making deep learning algorithms.
-
Python 2.7+
-
Scipy with Numpy
-
Matplotlib
-
Theano
-
Keras
-
TensorFlow
强烈建议通过 Anaconda 发行版安装 Python、NumPy、SciPy 和 Matplotlib。它包含所有这些软件包。
It is strongly recommend that Python, NumPy, SciPy, and Matplotlib are installed through the Anaconda distribution. It comes with all of those packages.
我们需要确保不同类型的软件都已正确安装。
We need to ensure that the different types of software are installed properly.
让我们转到我们的命令行程序,然后键入以下命令−
Let us go to our command line program and type in the following command −
$ python
Python 3.6.3 |Anaconda custom (32-bit)| (default, Oct 13 2017, 14:21:34)
[GCC 7.2.0] on linux
接下来,我们可以导入所需的类库并打印出它们的版本 −
Next, we can import the required libraries and print their versions −
import numpy
print numpy.__version__
Installation of Theano, TensorFlow and Keras
在我们开始安装软件包 − Theano、TensorFlow 和 Keras 之前,我们需要确认是否已安装 pip 。Anaconda 中的软件包管理系统称为 pip。
Before we begin with the installation of the packages − Theano, TensorFlow and Keras, we need to confirm if the pip is installed. The package management system in Anaconda is called the pip.
若要确认已安装 pip,请在命令行中键入以下内容 −
To confirm the installation of pip, type the following in the command line −
$ pip
确认已安装 pip 后,我们可以执行以下命令安装 TensorFlow 和 Keras −
Once the installation of pip is confirmed, we can install TensorFlow and Keras by executing the following command −
$pip install theano
$pip install tensorflow
$pip install keras
通过执行以下代码行确认已安装 Theano −
Confirm the installation of Theano by executing the following line of code −
$python –c “import theano: print (theano.__version__)”
Output
1.0.1
通过执行以下代码行确认已安装 Tensorflow −
Confirm the installation of Tensorflow by executing the following line of code −
$python –c “import tensorflow: print tensorflow.__version__”