The other day, I bought Introduction to Machine Learning Theory for IT Engineers.
It is necessary to prepare the execution environment of the Python sample code, but in the book, an efficient environment construction using Enthought Canopy is introduced. It has been.
However, somehow I want to avoid such tools at first, so I decided to install the necessary libraries by myself for the time being.
--Python2 has already been installed --Inexperienced in introducing machine learning related libraries with Python2 -Fight with CLI without using Enthought Canopy
The required libraries are:
After a quick investigation, I felt that PIL can only be used with Python2 series, so I decided to build the environment with Python2.
When I run IPython, I found that if I didn't include Virtualenv, I would get a lot of warnings, so I'll include Virtualenv first.
To be honest, I first learned about Virtualenv from a warning issued by IPython. I've never used Python except with TopCoder. For the time being, I managed to read the following two articles without thinking about anything. Really somehow.
Well, I will put it in for the time being.
$ pip install virtualenv
$ pip install virtualenvwrapper
Next, create a directory for the virtual environment. I thought the name could be anything, so I named it machine_learning
.
$ virtualenv --no-site-packages ~/work/machine_learning
Now that we have a virtual environment, let's go inside.
$ source ~/work/machine_learning
If the prompt looks like (machine_learning) $
, you're successful.
Below, we will proceed with the work in a virtual environment.
The following libraries are simply installed with pip with lowercase library names, such as pip install numpy
.
PIL It's a little quirky, you need to hit it like this:
$ pip install PIL --allow-external PIL --allow-unverified PIL
If you hit it with pip, it will come in quickly.
$ pip install ipython
Installation is complete. Since there is a test, I will hit the test.
$ iptest
It didn't move to the point of despair.
I will put in the missing libraries in order.
If you add this area, the test will pass.
To tell the truth, without thinking about anything at the beginning, I put in documents that seem to be out of date with almost no reading. There is also a library. If you haven't passed the test yet, you may want to try it.
I'm sorry to hit the command roughly.
RuntimeError The test passed, so I'm happy to hit ʻipython` to start it, and a RuntimeError will flow out like hot water. I almost cry.
Looking at the error message, it says matplotlib somehow, mac os x somehow, framework somehow. Read the article appropriately. I see.
It seems good to specify backend: TkAgg
in ~ / .matplotlib / matplotlibrc
.
~/.matplotlib/matplotlibrc
backend : TkAgg
Let's do it!
$ ipython
Python 2.7.9 (default, May 9 2015, 19:43:55)
Type "copyright", "credits" or "license" for more information.
IPython 4.0.0 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
Using matplotlib backend: TkAgg
In [1]:
It worked! You did it!
Recommended Posts