Artificial Intelligence for Robotics
上QQ阅读APP看书,第一时间看更新

Installing Python

The Linux Ubuntu system will come with a version of Python. I am going to assume that you are familiar with Python, as we will be using it throughout the book. If you need help with Python, Packt Publishing has several fine books on the subject. 

Once you log on to your Virtual Machine, check which version of Python you have by opening up a terminal window and typing python at the command prompt. You should see the Python version as follows:

Python 2.7.12 (default, Dec  4 2017, 14:50:18)
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>

You can see that I have version 2.7.12.

We are going to need several add-on libraries that augment Python and extend its capability. The first thing to check is to see whether you have pip installed. Pip is a Python Installation Package that helps to load other packages from the internet to extend Python. Check to see whether you have pip by typing the following:

pip

If you get No command 'pip' found, then you need to install pip. Enter the following:

Sudo apt-get install python-pip python-dev build-essential
Sudo pip install –upgrade pip

Now we can install the rest of the packages that we need. To begin with, we need the python math packages numpy, the scientific python libraries scipy, and the math plotting libraries matplotlib. I will direct you to install other packages as required in the relevant chapters.

Let’s install our other libraries. We need the numerical python library (numpy), the scientific python library (scipy), and matplotlib for making graphs:

>>sudo apt-get install python-numpy python-scipy python-matplotlib python-sympy

If you want to use the iPython (interactive Python) and Jupyter Notebook process to test your code (and document it at the same time), you can install those as well. I will not be using them in this book, but I do admit that they are quite useful.

>>sudo apt-get install ipython ipython-notebook

I'll cover the other Python libraries that we will use later (Open CV, Scikit-Learn, Keras, and so on) as we need them in the appropriate chapters.