Macでpython3の環境構築5---Matplotlibのインストール2---
さて、前回はfreetype2のイントールまで、とりあえずしたので、今回はmatplotlibのインストールをします。
まずは、zlibがない状態でしてみます。
とはいっても、前回までで下準備はしているので、やることはそんなにありません。
ターミナルを開き、次のようにコマンドを打ちます。
hiroshi-no-MacBook-Air:~ hiroshi$ pip3 install matplotlib #「pip3 install matplotlib」と打って、returnを押す。
そうすると、以下のような処理がされます。
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Collecting matplotlib
Downloading matplotlib-1.4.3-cp34-cp34m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (47.6MB)
100% |████████████████████████████████| 47.6MB 9.8kB/s
Collecting nose>=0.11.1 (from matplotlib)
Downloading nose-1.3.7-py3-none-any.whl (154kB)
100% |████████████████████████████████| 155kB 1.2MB/s
Collecting pyparsing!=2.0.0,>=1.5.6 (from matplotlib)
Downloading pyparsing-2.0.3-py2.py3-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6 in /usr/local/lib/python3.4/site-packages (from matplotlib)
Collecting six>=1.4 (from matplotlib)
Downloading six-1.9.0-py2.py3-none-any.whl
Collecting pytz (from matplotlib)
Downloading pytz-2015.4-py2.py3-none-any.whl (475kB)
100% |████████████████████████████████| 475kB 865kB/s
Collecting python-dateutil (from matplotlib)
Downloading python_dateutil-2.4.2-py2.py3-none-any.whl (188kB)
100% |████████████████████████████████| 192kB 1.5MB/s
Installing collected packages: nose, pyparsing, six, pytz, python-dateutil, matplotlib
Successfully installed matplotlib-1.4.3 nose-1.3.7 pyparsing-2.0.3 python-dateutil-2.4.2 pytz-2015.4 six-1.9.0
hiroshi-no-MacBook-Air:~ hiroshi$
試しに、もう一度、
hiroshi-no-MacBook-Air:~ hiroshi$ pip3 install matplotlib #「pip3 install matplotlib」と打って、returnを押す。
としてみると、
You are using pip version 7.1.0, however version 7.1.2 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Requirement already satisfied (use --upgrade to upgrade): matplotlib in /usr/local/lib/python3.4/site-packages
Requirement already satisfied (use --upgrade to upgrade): pytz in /usr/local/lib/python3.4/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): pyparsing!=2.0.0,>=1.5.6 in /usr/local/lib/python3.4/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): numpy>=1.6 in /usr/local/lib/python3.4/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): six>=1.4 in /usr/local/lib/python3.4/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): nose>=0.11.1 in /usr/local/lib/python3.4/site-packages (from matplotlib)
Requirement already satisfied (use --upgrade to upgrade): python-dateutil in /usr/local/lib/python3.4/site-packages (from matplotlib)
hiroshi-no-MacBook-Air:~ hiroshi$
となり無事インストールされていることがわかります。
ってあれ。zlibがなくてもインストールできたのかしら。
実行する段階でなにかエラーがでるのかと思い、試しにNetworkxのライブラリを使ったプログラムを組み、描画してみました。
『パーフェクトpython』という本を参考にして進めているので、以下のコードで試してみました。
import networkx as nx
from matplotlib import pyplot
def main() :
g=nx.Graph()
g.add_nodes_from(["node","test"])
g.add_star([1,2,3,4,5])
g.add_star([6,7,8,9])
nx.draw(g)
pyplot.show()
if __name__ == '__main__':
main()
しかし、出てくるのは、
あれ。ラベルがついてない。
もしや、zlibをいれなかったことが原因か。(後ほど調べてみたら、どうやらそうではないらしいですが。)
ということで、今一度zlibをインストールするところまで戻って試してみます。