【macOS】Pythonのpipで主要なライブラリをインストールする


概要

MacBookを新調したので、あらためてPythonでよく使用するライブラリをまとめ、インストールする。

インストールするライブラリ一覧

  • numpy
  • matplotlib
  • pandas
  • opencv-python
  • scikit-learn
  • scipy
  • Pillow
  • beautifulsoup4

環境

  • macOS 10.14.4 Mojave

前提

インストール実施

pipで複数パッケージをまとめてインストールするには、pip3 installの後にスペース区切りでパッケージ名を指定する。

$ pip3 install numpy matplotlib pandas opencv-python scikit-learn scipy Pillow beautifulsoup4
Collecting numpy
  Downloading https://files.pythonhosted.org/packages/43/6e/71a3af8680a159a141fab5b4d19988111a09c02ffbfdeb42175cca0fa341/numpy-1.16.3-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (13.9MB)
    100% |████████████████████████████████| 13.9MB 1.2MB/s 
Collecting matplotlib
  Downloading https://files.pythonhosted.org/packages/2e/81/bb51214944e79f9c9261badd7ef99b573fb0bc9110c0075c6a9e76224d0d/matplotlib-3.0.3-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (14.3MB)
    100% |████████████████████████████████| 14.3MB 1.4MB/s 
Collecting pandas
  Downloading https://files.pythonhosted.org/packages/fc/43/fd867e3347559845c8f993059d410c50a1e18709f1c4d4b3b47323a06a37/pandas-0.24.2-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (15.9MB)
    100% |████████████████████████████████| 15.9MB 1.4MB/s 
Collecting opencv-python
  Downloading https://files.pythonhosted.org/packages/8d/ff/13e77ee7ac431f831e20d81a6bf0214ca1cf550cf9b575e3213e14325c81/opencv_python-4.1.0.25-cp37-cp37m-macosx_10_7_x86_64.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (52.1MB)
    100% |████████████████████████████████| 52.1MB 564kB/s 
Collecting scikit-learn
  Downloading https://files.pythonhosted.org/packages/5b/96/bfb692ca7485bb7bde27f15aef8c7e72311e1b8df481e4bc3a7eeba42fc7/scikit_learn-0.21.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (10.5MB)
    100% |████████████████████████████████| 10.5MB 2.0MB/s 
Collecting scipy
  Downloading https://files.pythonhosted.org/packages/dd/6c/ccf7403d14f0ab0f20ce611696921f204f4ffce99a4fd383c892a6a7e9eb/scipy-1.2.1-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (27.3MB)
    100% |████████████████████████████████| 27.3MB 966kB/s 
Collecting Pillow
  Downloading https://files.pythonhosted.org/packages/22/55/2ce41fa510f131c776112a1d24ee90cddffc96f1bf0311efb14fdd8ae877/Pillow-6.0.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (3.7MB)
    100% |████████████████████████████████| 3.7MB 940kB/s 
Collecting beautifulsoup4
  Downloading https://files.pythonhosted.org/packages/1d/5d/3260694a59df0ec52f8b4883f5d23b130bc237602a1411fa670eae12351e/beautifulsoup4-4.7.1-py3-none-any.whl (94kB)
    100% |████████████████████████████████| 102kB 1.6MB/s 
Collecting cycler>=0.10 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/f7/d2/e07d3ebb2bd7af696440ce7e754c59dd546ffe1bbe732c8ab68b9c834e61/cycler-0.10.0-py2.py3-none-any.whl
Requirement already satisfied: python-dateutil>=2.1 in /usr/local/lib/python3.7/site-packages (from matplotlib) (2.8.0)
Collecting pyparsing!=2.0.4,!=2.1.2,!=2.1.6,>=2.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/dd/d9/3ec19e966301a6e25769976999bd7bbe552016f0d32b577dc9d63d2e0c49/pyparsing-2.4.0-py2.py3-none-any.whl (62kB)
    100% |████████████████████████████████| 71kB 1.7MB/s 
Collecting kiwisolver>=1.0.1 (from matplotlib)
  Downloading https://files.pythonhosted.org/packages/df/93/8bc9b52a8846be2b9572aa0a7c881930939b06e4abe1162da6a0430b794f/kiwisolver-1.1.0-cp37-cp37m-macosx_10_6_intel.macosx_10_9_intel.macosx_10_9_x86_64.macosx_10_10_intel.macosx_10_10_x86_64.whl (113kB)
    100% |████████████████████████████████| 122kB 1.1MB/s 
Collecting pytz>=2011k (from pandas)
  Downloading https://files.pythonhosted.org/packages/3d/73/fe30c2daaaa0713420d0382b16fbb761409f532c56bdcc514bf7b6262bb6/pytz-2019.1-py2.py3-none-any.whl (510kB)
    100% |████████████████████████████████| 512kB 2.3MB/s 
Collecting joblib>=0.11 (from scikit-learn)
  Downloading https://files.pythonhosted.org/packages/cd/c1/50a758e8247561e58cb87305b1e90b171b8c767b15b12a1734001f41d356/joblib-0.13.2-py2.py3-none-any.whl (278kB)
    100% |████████████████████████████████| 286kB 1.3MB/s 
Collecting soupsieve>=1.2 (from beautifulsoup4)
  Downloading https://files.pythonhosted.org/packages/b9/a5/7ea40d0f8676bde6e464a6435a48bc5db09b1a8f4f06d41dd997b8f3c616/soupsieve-1.9.1-py2.py3-none-any.whl
Requirement already satisfied: six in /usr/local/lib/python3.7/site-packages (from cycler>=0.10->matplotlib) (1.12.0)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from kiwisolver>=1.0.1->matplotlib) (40.8.0)
Installing collected packages: numpy, cycler, pyparsing, kiwisolver, matplotlib, pytz, pandas, opencv-python, joblib, scipy, scikit-learn, Pillow, soupsieve, beautifulsoup4
Successfully installed Pillow-6.0.0 beautifulsoup4-4.7.1 cycler-0.10.0 joblib-0.13.2 kiwisolver-1.1.0 matplotlib-3.0.3 numpy-1.16.3 opencv-python-4.1.0.25 pandas-0.24.2 pyparsing-2.4.0 pytz-2019.1 scikit-learn-0.21.0 scipy-1.2.1 soupsieve-1.9.1

インストールされたパッケージの確認

$ pip3 list
Package            Version 
------------------ --------
appnope            0.1.0   
attrs              19.1.0  
backcall           0.1.0   
beautifulsoup4     4.7.1   
bleach             3.1.0   
cycler             0.10.0  
decorator          4.4.0   
defusedxml         0.6.0   
entrypoints        0.3     
ipykernel          5.1.0   
ipython            7.5.0   
ipython-genutils   0.2.0   
ipywidgets         7.4.2   
jedi               0.13.3  
Jinja2             2.10.1  
joblib             0.13.2  
jsonschema         3.0.1   
jupyter            1.0.0   
jupyter-client     5.2.4   
jupyter-console    6.0.0   
jupyter-core       4.4.0   
kiwisolver         1.1.0   
MarkupSafe         1.1.1   
matplotlib         3.0.3   
mistune            0.8.4   
nbconvert          5.5.0   
nbformat           4.4.0   
notebook           5.7.8   
numpy              1.16.3  
opencv-python      4.1.0.25
pandas             0.24.2  
pandocfilters      1.4.2   
parso              0.4.0   
pexpect            4.7.0   
pickleshare        0.7.5   
Pillow             6.0.0   
pip                19.0.3  
prometheus-client  0.6.0   
prompt-toolkit     2.0.9   
ptyprocess         0.6.0   
Pygments           2.4.0   
pyparsing          2.4.0   
pyrsistent         0.15.1  
python-dateutil    2.8.0   
pytz               2019.1  
pyzmq              18.0.1  
qtconsole          4.4.4   
scikit-learn       0.21.0  
scipy              1.2.1   
Send2Trash         1.5.0   
setuptools         40.8.0  
six                1.12.0  
soupsieve          1.9.1   
terminado          0.8.2   
testpath           0.4.2   
tornado            6.0.2   
traitlets          4.3.2   
wcwidth            0.1.7   
webencodings       0.5.1   
wheel              0.33.1  
widgetsnbextension 3.4.2