How to Introduce IPython (Python2) to Mac OS X-Preparation for Introduction to Machine Learning Theory-

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.

Target audience

--Python2 has already been installed --Inexperienced in introducing machine learning related libraries with Python2 -Fight with CLI without using Enthought Canopy

Required library

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.

Preparation (Virtualenv)

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.

Library installation

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

I will put in IPython

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

How to Introduce IPython (Python2) to Mac OS X-Preparation for Introduction to Machine Learning Theory-
An introduction to Python for machine learning
How to use machine learning for work? 03_Python coding procedure
I tried to build an environment for machine learning with Python (Mac OS X)
Python learning memo for machine learning by Chainer Chapter 8 Introduction to Numpy
Python learning memo for machine learning by Chainer Chapter 10 Introduction to Cupy
An introduction to OpenCV for machine learning
Python learning memo for machine learning by Chainer Chapter 9 Introduction to scikit-learn
Take the free "Introduction to Python for Machine Learning" online until 4/27 application
Introduction to Graph Database Neo4j in Python for Beginners (for Mac OS X)
[Python] Easy introduction to machine learning with python (SVM)
An introduction to machine learning for bot developers
[For beginners] Introduction to vectorization in machine learning
Introduction to machine learning
Python learning notes for machine learning with Chainer Chapters 11 and 12 Introduction to Pandas Matplotlib
Build a machine learning Python environment on Mac OS
Preparing to start "Python machine learning programming" (for macOS)
[Introduction to Python] How to write repetitive statements using for statements
An introduction to machine learning
Super introduction to machine learning
Introduction to Python For, While
Introduction to machine learning Note writing
[Introduction to Python] How to parse JSON
<For beginners> python library <For machine learning>
Introduction to Machine Learning Library SHOGUN
An introduction to Python for non-engineers
Introduction to Python Django (2) Mac Edition
How to collect machine learning data
Introduction to Python Basics of Machine Learning (Unsupervised Learning / Principal Component Analysis)
Before the introduction to machine learning. ~ Technology required for machine learning other than machine learning ~
How to use machine learning for work? 01_ Understand the purpose of machine learning
[Introduction to Python] How to use class in Python?
scikit-learn How to use summary (machine learning)
Amplify images for machine learning with python
[Definitive Edition] Building an environment for learning "machine learning" using Python on Mac
I installed Python 3.5.1 to study machine learning
How to use machine learning for work? 02_Overview of AI development project
How to prepare Python development environment [Mac]
How to erase Python 2.x on Mac.
[Shakyo] Encounter with Python for machine learning
Introduction to ClearML-Easy to manage machine learning experiments-
[Python] Web application design for machine learning
Python beginners publish web applications using machine learning [Part 2] Introduction to explosive Python !!
How to enjoy Coursera / Machine Learning (Week 10)
How to use "deque" for Python data
An introduction to Python for C programmers
How to build an environment for using multiple versions of Python on Mac
How to put python library numpy, scipy, matplotlib, ipython, PIL, basemap on Mac
[Introduction to Python] How to get the index of data with a for statement
[Super Introduction to Machine Learning] Learn Pytorch tutorials
[Introduction to Udemy Python3 + Application] 23. How to use tuples
Upgrade the Azure Machine Learning SDK for Python
Python & Machine Learning Study Memo ②: Introduction of Library
How to install Python for pharmaceutical company researchers
[Introduction to Python] How to handle JSON format data
[Python] Collect images with Icrawler for machine learning [1000 images]
[Introduction to Udemy Python3 + Application] 43. for else statement
[Super Introduction to Machine Learning] Learn Pytorch tutorials
Introduction to Programming (Python) TA Tendency for beginners
How to make Python faster for beginners [numpy]
Understand Python for Pepper development. -Introduction to Python Box-