2-4. Python3 ライブラリのインストール
## Jupyter Notebookの環境が完成しました。
あとはPythonのライブラリを入れていきます。
欲しいライブラリはこちら
- NumPy
- SciPy
- Sklearn
- MatPlotLib
- Pillow
pipコマンドでインストールします。
### NumPy
[me@PC ~]$ pip install numpy
Collecting numpy
Downloading numpy-1.11.3-cp36-cp36m-manylinux1_x86_64.whl (15.7MB)
100% |████████████████████████████████| 15.7MB 23kB/s
Installing collected packages: numpy
Successfully installed numpy-1.11.3
### SciPy
[me@PC ~]$ pip install scipy
Collecting scipy
Downloading scipy-0.18.1-cp36-cp36m-manylinux1_x86_64.whl (42.5MB)
100% |████████████████████████████████| 42.5MB 9.0kB/s
Installing collected packages: scipy
Successfully installed scipy-0.18.1
### SkLearn
[me@PC ~]$ pip install sklearn
Collecting sklearn
Downloading sklearn-0.0.tar.gz
Collecting scikit-learn (from sklearn)
Downloading scikit-learn-0.18.1.tar.gz (8.9MB)
100% |████████████████████████████████| 8.9MB 43kB/s
Installing collected packages: scikit-learn, sklearn
Running setup.py install for scikit-learn ... done
Running setup.py install for sklearn ... done
Successfully installed scikit-learn-0.18.1 sklearn-0.0
### MatPlotLib
[me@PC ~]$ pip install matplotlib
Collecting matplotlib
Downloading matplotlib-1.5.3.tar.gz (51.6MB)
100% |████████████████████████████████| 51.6MB 7.1kB/s
Complete output from command python setup.py egg_info:
============================================================================
Edit setup.cfg to change the build options
BUILDING MATPLOTLIB
matplotlib: yes [1.5.3]
python: yes [3.6.0 (default, Jan 4 2017, 01:52:52) [GCC
4.8.5 20150623 (Red Hat 4.8.5-11)]]
platform: yes [linux]
REQUIRED DEPENDENCIES AND EXTENSIONS
numpy: yes [version 1.11.3]
dateutil: yes [dateutil was not found. It is required for date
axis support. pip/easy_install may attempt to
install it after matplotlib.]
pytz: yes [pytz was not found. pip will attempt to install
it after matplotlib.]
cycler: yes [cycler was not found. pip will attempt to
install it after matplotlib.]
tornado: yes [using tornado version 4.4.2]
pyparsing: yes [pyparsing was not found. It is required for
mathtext support. pip/easy_install may attempt to
install it after matplotlib.]
libagg: yes [pkg-config information for 'libagg' could not
be found. Using local copy.]
freetype: no [The C/C++ header for freetype2 (ft2build.h)
could not be found. You may need to install the
development package.]
png: no [pkg-config information for 'libpng' could not
be found.]
qhull: yes [pkg-config information for 'qhull' could not be
found. Using local copy.]
OPTIONAL SUBPACKAGES
略
============================================================================
* The following required packages can not be built:
* freetype, png
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-esbw1iku/matplotlib/
[me@PC ~]$
おっと、依存ライブラリに不足があるのですね。
freetype, png が無いとおっしゃるのですが、これらは、python-freetype, libpngという名前でyumに居るようです。
[me@PC ~]$ su Password: [root@PC me]# yum install freetype-devel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * epel: epel.excellmedia.net * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp Resolving Dependencies --> Running transaction check ---> Package freetype-devel.x86_64 0:2.4.11-12.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: freetype-devel x86_64 2.4.11-12.el7 base 356 k Transaction Summary ==================================================================================================== Install 1 Package Total download size: 356 k Installed size: 2.4 M Is this ok [y/d/N]: y Downloading packages: freetype-devel-2.4.11-12.el7.x86_64.rpm | 356 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : freetype-devel-2.4.11-12.el7.x86_64 1/1 Verifying : freetype-devel-2.4.11-12.el7.x86_64 1/1 Installed: freetype-devel.x86_64 0:2.4.11-12.el7 Complete! [root@PC me]# yum install libpng-devel Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: ftp.iij.ad.jp * epel: epel.excellmedia.net * extras: ftp.iij.ad.jp * updates: ftp.iij.ad.jp Resolving Dependencies --> Running transaction check ---> Package libpng-devel.x86_64 2:1.5.13-7.el7_2 will be installed --> Processing Dependency: libpng(x86-64) = 2:1.5.13-7.el7_2 for package: 2:libpng-devel-1.5.13-7.el7_2.x86_64 --> Processing Dependency: libpng15.so.15()(64bit) for package: 2:libpng-devel-1.5.13-7.el7_2.x86_64 --> Running transaction check ---> Package libpng.x86_64 2:1.5.13-7.el7_2 will be installed --> Finished Dependency Resolution Dependencies Resolved ==================================================================================================== Package Arch Version Repository Size ==================================================================================================== Installing: libpng-devel x86_64 2:1.5.13-7.el7_2 base 122 k Installing for dependencies: libpng x86_64 2:1.5.13-7.el7_2 base 213 k Transaction Summary ==================================================================================================== Install 1 Package (+1 Dependent package) Total download size: 334 k Installed size: 813 k Is this ok [y/d/N]: y Downloading packages: (1/2): libpng-1.5.13-7.el7_2.x86_64.rpm | 213 kB 00:00:00 (2/2): libpng-devel-1.5.13-7.el7_2.x86_64.rpm | 122 kB 00:00:00 ---------------------------------------------------------------------------------------------------- Total 539 kB/s | 334 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 2:libpng-1.5.13-7.el7_2.x86_64 1/2 Installing : 2:libpng-devel-1.5.13-7.el7_2.x86_64 2/2 Verifying : 2:libpng-devel-1.5.13-7.el7_2.x86_64 1/2 Verifying : 2:libpng-1.5.13-7.el7_2.x86_64 2/2 Installed: libpng-devel.x86_64 2:1.5.13-7.el7_2 Dependency Installed: libpng.x86_64 2:1.5.13-7.el7_2 Complete!
気を取り直して、もう一度matplotlibのインストールだ!
[root@PC me]# exit
exit
[me@PC ~]$ pip install matplotlib
Collecting matplotlib
Using cached matplotlib-1.5.3.tar.gz
Requirement already satisfied: numpy>=1.6 in ./.pyenv/versions/3.6.0/lib/python3.6/site-packages (from matplotlib)
Collecting python-dateutil (from matplotlib)
Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
100% |████████████████████████████████| 194kB 1.1MB/s
Collecting pytz (from matplotlib)
Downloading pytz-2016.10-py2.py3-none-any.whl (483kB)
100% |████████████████████████████████| 491kB 640kB/s
Collecting cycler (from matplotlib)
Downloading cycler-0.10.0-py2.py3-none-any.whl
Collecting pyparsing!=2.0.0,!=2.0.4,!=2.1.2,>=1.5.6 (from matplotlib)
Downloading pyparsing-2.1.10-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 1.8MB/s
Requirement already satisfied: six>=1.5 in ./.pyenv/versions/3.6.0/lib/python3.6/site-packages (from python-dateutil->matplotlib)
Installing collected packages: python-dateutil, pytz, cycler, pyparsing, matplotlib
Running setup.py install for matplotlib ... done
Successfully installed cycler-0.10.0 matplotlib-1.5.3 pyparsing-2.1.10 python-dateutil-2.6.0 pytz-2016.10
[me@PC ~]$
### Pillow
[me@PC ~]$ pip install pillow
Collecting pillow
Downloading Pillow-4.0.0-cp36-cp36m-manylinux1_x86_64.whl (5.6MB)
100% |████████████████████████████████| 5.6MB 66kB/s
Collecting olefile (from pillow)
Downloading olefile-0.43.zip (119kB)
100% |████████████████████████████████| 122kB 2.0MB/s
Installing collected packages: olefile, pillow
Running setup.py install for olefile ... done
Successfully installed olefile-0.43 pillow-4.0.0
以上、環境構築の終了が見えてきました!!
[次は、matplotlib用のフォントの準備](/2017/01/makejupyter25.html)