2017年3月24日 星期五

樹莓派安裝 Python2 scikit-learn 函式庫

前幾天在 Python3 環境下完成機器學習套件 scikit-learn 的安裝後, 看到有一本書是使用 Python 2.7 版的 scikit-learn, 作者提到有許多機器學習演算法還使用 Python 2 語法, 所以建議使用 2 版的較保險. 所以我又在樹莓派再安裝一次 Python2 版的 scikit-learn, 其指令與 Python3 版不同, 用 python 取代 python3 即可 :
  1. sudo apt-get install python-numpy
  2. sudo apt-get install python-scipy
  3. sudo apt-get install python-matplotlib
  4. sudo apt-get install python-pandas
  5. sudo pip install scikit-learn -U
  6. sudo apt-get install ipython (不一定要安裝)
  7. sudo apt-get install ipython-notebook (不一定要安裝)
其中 ipython 與 ipython-notebook 是 Python 網頁互動式開發工具, 不是機器學習必要之套件, 有要用到 notebook 時再安裝, 參考 :

樹莓派安裝 Python3 scikit-learn 函式庫

過程紀錄如下 :

1. 安裝 numpy :

pi@raspberrypi:~ $ sudo apt-get install python-numpy
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-numpy is already the newest version.
python-numpy set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 7 not upgraded.

2. 安裝 scipy :

pi@raspberrypi:~ $ sudo apt-get install python-scipy
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libpython-dev libpython2.7-dev python-decorator python-dev python-imaging python2.7-dev
The following NEW packages will be installed:
  libpython-dev libpython2.7-dev python-decorator python-dev python-imaging python-scipy python2.7-dev
0 upgraded, 7 newly installed, 0 to remove and 7 not upgraded.
Need to get 25.6 MB of archives.
After this operation, 54.8 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libpython2.7-dev armhf 2.7.9-2+deb8u1 [17.9 MB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-dev armhf 2.7.9-1 [1,188 B]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main libpython-dev armhf 2.7.9-1 [19.6 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-decorator all 3.4.0-2 [22.3 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main python2.7-dev armhf 2.7.9-2+deb8u1 [287 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-imaging all 2.6.1-2+deb8u3 [9,846 B]
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-scipy armhf 0.14.0-2 [7,345 kB]
Fetched 25.6 MB in 18s (1,369 kB/s)
Selecting previously unselected package libpython2.7-dev:armhf.
(Reading database ... 124087 files and directories currently installed.)
Preparing to unpack .../libpython2.7-dev_2.7.9-2+deb8u1_armhf.deb ...
Unpacking libpython2.7-dev:armhf (2.7.9-2+deb8u1) ...
Selecting previously unselected package libpython-dev:armhf.
Preparing to unpack .../libpython-dev_2.7.9-1_armhf.deb ...
Unpacking libpython-dev:armhf (2.7.9-1) ...
Selecting previously unselected package python-decorator.
Preparing to unpack .../python-decorator_3.4.0-2_all.deb ...
Unpacking python-decorator (3.4.0-2) ...
Selecting previously unselected package python2.7-dev.
Preparing to unpack .../python2.7-dev_2.7.9-2+deb8u1_armhf.deb ...
Unpacking python2.7-dev (2.7.9-2+deb8u1) ...
Selecting previously unselected package python-dev.
Preparing to unpack .../python-dev_2.7.9-1_armhf.deb ...
Unpacking python-dev (2.7.9-1) ...
Selecting previously unselected package python-imaging.
Preparing to unpack .../python-imaging_2.6.1-2+deb8u3_all.deb ...
Unpacking python-imaging (2.6.1-2+deb8u3) ...
Selecting previously unselected package python-scipy.
Preparing to unpack .../python-scipy_0.14.0-2_armhf.deb ...
Unpacking python-scipy (0.14.0-2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libpython2.7-dev:armhf (2.7.9-2+deb8u1) ...
Setting up libpython-dev:armhf (2.7.9-1) ...
Setting up python-decorator (3.4.0-2) ...
Setting up python2.7-dev (2.7.9-2+deb8u1) ...
Setting up python-dev (2.7.9-1) ...
Setting up python-imaging (2.6.1-2+deb8u3) ...
Setting up python-scipy (0.14.0-2) ...

3. 安裝 matplotlib :

pi@raspberrypi~ $ sudo apt-get install python-matplotlib

Reading package lists... 0%

Reading package lists... 100%

Reading package lists... Done

Building dependency tree... 0%

Building dependency tree... 0%

Building dependency tree... 50%

Building dependency tree... 50%

Building dependency tree... 55%

Building dependency tree... 70%

Building dependency tree... 85%

Building dependency tree... 100%

Building dependency tree      

Reading state information... 0%

Reading state information... 0%

Reading state information... Done

The following extra packages will be installed:
  fonts-lyx libglade2-0 libjs-jquery-ui python-dateutil python-glade2 python-matplotlib-data python-mock python-nose python-pyparsing python-tz
Suggested packages:
  libjs-jquery-ui-docs python-gtk2-doc dvipng ghostscript inkscape ipython python-cairocffi python-configobj python-excelerator python-matplotlib-doc
  python-qt4 python-sip python-tornado python-traits python-wxgtk3.0 texlive-extra-utils texlive-latex-extra ttf-staypuft python-mock-doc python-coverage
  python-nose-doc
The following NEW packages will be installed:
  fonts-lyx libglade2-0 libjs-jquery-ui python-dateutil python-glade2 python-matplotlib python-matplotlib-data python-mock python-nose python-pyparsing
  python-tz
0 upgraded, 11 newly installed, 0 to remove and 7 not upgraded.
Need to get 7,803 kB of archives.
After this operation, 22.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y

0% [Working]
         
0% [Connecting to mirrordirector.raspbian.org (93.93.128.193)]
                                                           
0% [Waiting for headers]
                     
0% [Working]
         
0% [Waiting for headers]
                     
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libglade2-0 armhf 1:2.6.4-2 [76.2 kB]

                     
0% [1 libglade2-0 0 B/76.2 kB 0%] [Waiting for headers]
                                                     
1% [Waiting for headers]
                     
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main fonts-lyx all 2.1.2-2 [176 kB]

                     
1% [2 fonts-lyx 0 B/176 kB 0%] [Waiting for headers]
                                                 
3% [Waiting for headers]
3% [Waiting for headers]
                     
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjs-jquery-ui all 1.10.1+dfsg-1 [499 kB]

                     
3% [3 libjs-jquery-ui 0 B/499 kB 0%] [Waiting for headers]
                                                       
7% [3 libjs-jquery-ui 256 kB/499 kB 51%]
                                     
10% [Waiting for headers]
                       
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-dateutil all 2.2-2 [51.3 kB]
                     
10% [4 python-dateutil 0 B/51.3 kB 0%] [Waiting for headers]
                                                         
10% [Waiting for headers]
10% [Waiting for headers]
                       
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-glade2 armhf 2.24.0-4 [42.1 kB]
                   
10% [5 python-glade2 0 B/42.1 kB 0%] [Waiting for headers]
                                                       
11% [Waiting for headers]
11% [Waiting for headers]
                       
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-matplotlib-data all 1.4.2-3.1 [3,041 kB]
                     
11% [6 python-matplotlib-data 0 B/3,041 kB 0%] [Waiting for headers]
                                                                 
17% [6 python-matplotlib-data 496 kB/3,041 kB 16%]
                                               
24% [6 python-matplotlib-data 1,048 kB/3,041 kB 34%]
33% [6 python-matplotlib-data 1,699 kB/3,041 kB 56%]
39% [6 python-matplotlib-data 2,236 kB/3,041 kB 74%]
45% [6 python-matplotlib-data 2,664 kB/3,041 kB 88%]
                                                 
50% [Working]
           
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-pyparsing all 2.0.3+dfsg1-1 [64.0 kB]
         
50% [7 python-pyparsing 0 B/64.0 kB 0%]
                                     
51% [Working]
           
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-tz all 2012c+dfsg-0.1 [31.9 kB]
         
51% [8 python-tz 0 B/31.9 kB 0%]
                             
51% [Working]
           
Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-mock all 1.0.1-3 [33.2 kB]
         
51% [9 python-mock 0 B/33.2 kB 0%]
                               
51% [Working]
           
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-nose all 1.3.4-1 [134 kB]
         
51% [10 python-nose 0 B/134 kB 0%]
                               
53% [Working]
           
Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-matplotlib armhf 1.4.2-3.1 [3,654 kB]
         
53% [11 python-matplotlib 0 B/3,654 kB 0%]
                                       
63% [11 python-matplotlib 751 kB/3,654 kB 21%]                                                                                                   772 kB/s 3s
73% [11 python-matplotlib 1,562 kB/3,654 kB 43%]                                                                                                 772 kB/s 2s
83% [11 python-matplotlib 2,337 kB/3,654 kB 64%]                                                                                                 772 kB/s 1s
93% [11 python-matplotlib 3,134 kB/3,654 kB 86%]                                                                                                 772 kB/s 0s
100% [Working]                                                                                                                                   772 kB/s 0s
                                                                                                                                                         
Fetched 7,803 kB in 8s (952 kB/s)
Selecting previously unselected package libglade2-0:armhf.
(Reading database ...
(Reading database ... 5%
(Reading database ... 10%
(Reading database ... 15%
(Reading database ... 20%
(Reading database ... 25%
(Reading database ... 30%
(Reading database ... 35%
(Reading database ... 40%
(Reading database ... 45%
(Reading database ... 50%
(Reading database ... 55%
(Reading database ... 60%
(Reading database ... 65%
(Reading database ... 70%
(Reading database ... 75%
(Reading database ... 80%
(Reading database ... 85%
(Reading database ... 90%
(Reading database ... 95%
(Reading database ... 100%
(Reading database ... 125300 files and directories currently installed.)
Preparing to unpack .../libglade2-0_1%3a2.6.4-2_armhf.deb ...
Unpacking libglade2-0:armhf (1:2.6.4-2) ...
Selecting previously unselected package fonts-lyx.
Preparing to unpack .../fonts-lyx_2.1.2-2_all.deb ...
Unpacking fonts-lyx (2.1.2-2) ...
Selecting previously unselected package libjs-jquery-ui.
Preparing to unpack .../libjs-jquery-ui_1.10.1+dfsg-1_all.deb ...
Unpacking libjs-jquery-ui (1.10.1+dfsg-1) ...
Selecting previously unselected package python-dateutil.
Preparing to unpack .../python-dateutil_2.2-2_all.deb ...
Unpacking python-dateutil (2.2-2) ...
Selecting previously unselected package python-glade2.
Preparing to unpack .../python-glade2_2.24.0-4_armhf.deb ...
Unpacking python-glade2 (2.24.0-4) ...
Selecting previously unselected package python-matplotlib-data.
Preparing to unpack .../python-matplotlib-data_1.4.2-3.1_all.deb ...
Unpacking python-matplotlib-data (1.4.2-3.1) ...
Selecting previously unselected package python-pyparsing.
Preparing to unpack .../python-pyparsing_2.0.3+dfsg1-1_all.deb ...
Unpacking python-pyparsing (2.0.3+dfsg1-1) ...
Selecting previously unselected package python-tz.
Preparing to unpack .../python-tz_2012c+dfsg-0.1_all.deb ...
Unpacking python-tz (2012c+dfsg-0.1) ...
Selecting previously unselected package python-mock.
Preparing to unpack .../python-mock_1.0.1-3_all.deb ...
Unpacking python-mock (1.0.1-3) ...
Selecting previously unselected package python-nose.
Preparing to unpack .../python-nose_1.3.4-1_all.deb ...
Unpacking python-nose (1.3.4-1) ...
Selecting previously unselected package python-matplotlib.
Preparing to unpack .../python-matplotlib_1.4.2-3.1_armhf.deb ...
Unpacking python-matplotlib (1.4.2-3.1) ...
Processing triggers for fontconfig (2.11.0-6.3+deb8u1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libglade2-0:armhf (1:2.6.4-2) ...
Setting up fonts-lyx (2.1.2-2) ...
Setting up libjs-jquery-ui (1.10.1+dfsg-1) ...
Setting up python-dateutil (2.2-2) ...
Setting up python-glade2 (2.24.0-4) ...
Setting up python-matplotlib-data (1.4.2-3.1) ...
Setting up python-pyparsing (2.0.3+dfsg1-1) ...
Setting up python-tz (2012c+dfsg-0.1) ...
Setting up python-mock (1.0.1-3) ...
Setting up python-nose (1.3.4-1) ...
Setting up python-matplotlib (1.4.2-3.1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...

4. 安裝 pandas :

pi@raspberrypi:~ $ sudo apt-get install python-pandas
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libhdf5-8 liblz4-1 libsnappy1 python-antlr python-bs4 python-joblib python-numexpr python-openpyxl python-pandas-lib
  python-simplejson python-statsmodels python-statsmodels-lib python-tables python-tables-data python-tables-lib python-xlrd
  python-xlwt
Suggested packages:
  python-pandas-doc python-tables-doc python-netcdf vitables
The following NEW packages will be installed:
  libhdf5-8 liblz4-1 libsnappy1 python-antlr python-bs4 python-joblib python-numexpr python-openpyxl python-pandas python-pandas-lib
  python-simplejson python-statsmodels python-statsmodels-lib python-tables python-tables-data python-tables-lib python-xlrd
  python-xlwt
0 upgraded, 18 newly installed, 0 to remove and 18 not upgraded.
Need to get 7,369 kB of archives.
After this operation, 38.6 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libhdf5-8 armhf 1.8.13+docs-15+deb8u1 [975 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main liblz4-1 armhf 0.0~r122-2 [14.8 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-antlr all 2.7.7+dfsg-6 [25.8 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-bs4 all 4.3.2-2 [77.7 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-joblib all 0.8.3-1 [63.9 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-numexpr armhf 2.4-1 [150 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-openpyxl all 1.7.0+ds1-1 [75.7 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-pandas-lib armhf 0.14.1-2 [1,209 kB]
Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-pandas all 0.14.1-2 [1,252 kB]
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-simplejson armhf 3.6.5-1 [65.0 kB]
Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main libsnappy1 armhf 1.1.2-3 [39.8 kB]
Get:12 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-tables-lib armhf 3.1.1-3+b1 [313 kB]
Get:13 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-tables-data all 3.1.1-3 [48.5 kB]
Get:14 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-tables all 3.1.1-3 [337 kB]
Get:15 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-xlrd all 0.9.2-1 [143 kB]
Get:16 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-xlwt all 0.7.5+debian1-1 [85.1 kB]
Get:17 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-statsmodels-lib armhf 0.4.2-1.2 [46.2 kB]
Get:18 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-statsmodels all 0.4.2-1.2 [2,448 kB]
Fetched 7,369 kB in 11s (624 kB/s)
Selecting previously unselected package libhdf5-8:armhf.
(Reading database ... 138178 files and directories currently installed.)
Preparing to unpack .../libhdf5-8_1.8.13+docs-15+deb8u1_armhf.deb ...
Unpacking libhdf5-8:armhf (1.8.13+docs-15+deb8u1) ...
Selecting previously unselected package liblz4-1:armhf.
Preparing to unpack .../liblz4-1_0.0~r122-2_armhf.deb ...
Unpacking liblz4-1:armhf (0.0~r122-2) ...
Selecting previously unselected package python-antlr.
Preparing to unpack .../python-antlr_2.7.7+dfsg-6_all.deb ...
Unpacking python-antlr (2.7.7+dfsg-6) ...
Selecting previously unselected package python-bs4.
Preparing to unpack .../python-bs4_4.3.2-2_all.deb ...
Unpacking python-bs4 (4.3.2-2) ...
Selecting previously unselected package python-joblib.
Preparing to unpack .../python-joblib_0.8.3-1_all.deb ...
Unpacking python-joblib (0.8.3-1) ...
Selecting previously unselected package python-numexpr.
Preparing to unpack .../python-numexpr_2.4-1_armhf.deb ...
Unpacking python-numexpr (2.4-1) ...
Selecting previously unselected package python-openpyxl.
Preparing to unpack .../python-openpyxl_1.7.0+ds1-1_all.deb ...
Unpacking python-openpyxl (1.7.0+ds1-1) ...
Selecting previously unselected package python-pandas-lib.
Preparing to unpack .../python-pandas-lib_0.14.1-2_armhf.deb ...
Unpacking python-pandas-lib (0.14.1-2) ...
Selecting previously unselected package python-pandas.
Preparing to unpack .../python-pandas_0.14.1-2_all.deb ...
Unpacking python-pandas (0.14.1-2) ...
Selecting previously unselected package python-simplejson.
Preparing to unpack .../python-simplejson_3.6.5-1_armhf.deb ...
Unpacking python-simplejson (3.6.5-1) ...
Selecting previously unselected package libsnappy1.
Preparing to unpack .../libsnappy1_1.1.2-3_armhf.deb ...
Unpacking libsnappy1 (1.1.2-3) ...
Selecting previously unselected package python-tables-lib.
Preparing to unpack .../python-tables-lib_3.1.1-3+b1_armhf.deb ...
Unpacking python-tables-lib (3.1.1-3+b1) ...
Selecting previously unselected package python-tables-data.
Preparing to unpack .../python-tables-data_3.1.1-3_all.deb ...
Unpacking python-tables-data (3.1.1-3) ...
Selecting previously unselected package python-tables.
Preparing to unpack .../python-tables_3.1.1-3_all.deb ...
Unpacking python-tables (3.1.1-3) ...
Selecting previously unselected package python-xlrd.
Preparing to unpack .../python-xlrd_0.9.2-1_all.deb ...
Unpacking python-xlrd (0.9.2-1) ...
Selecting previously unselected package python-xlwt.
Preparing to unpack .../python-xlwt_0.7.5+debian1-1_all.deb ...
Unpacking python-xlwt (0.7.5+debian1-1) ...
Selecting previously unselected package python-statsmodels-lib.
Preparing to unpack .../python-statsmodels-lib_0.4.2-1.2_armhf.deb ...
Unpacking python-statsmodels-lib (0.4.2-1.2) ...
Selecting previously unselected package python-statsmodels.
Preparing to unpack .../python-statsmodels_0.4.2-1.2_all.deb ...
Unpacking python-statsmodels (0.4.2-1.2) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libhdf5-8:armhf (1.8.13+docs-15+deb8u1) ...
Setting up liblz4-1:armhf (0.0~r122-2) ...
Setting up python-antlr (2.7.7+dfsg-6) ...
Setting up python-bs4 (4.3.2-2) ...
Setting up python-joblib (0.8.3-1) ...
Setting up python-numexpr (2.4-1) ...
Setting up python-openpyxl (1.7.0+ds1-1) ...
Setting up python-pandas-lib (0.14.1-2) ...
Setting up python-pandas (0.14.1-2) ...
Setting up python-simplejson (3.6.5-1) ...
Setting up libsnappy1 (1.1.2-3) ...
Setting up python-tables-lib (3.1.1-3+b1) ...
Setting up python-tables-data (3.1.1-3) ...
Setting up python-tables (3.1.1-3) ...
Setting up python-xlrd (0.9.2-1) ...
Setting up python-xlwt (0.7.5+debian1-1) ...
Setting up python-statsmodels-lib (0.4.2-1.2) ...
Setting up python-statsmodels (0.4.2-1.2) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...
Processing triggers for python-support (1.0.15) ...

5. 安裝 scikit-learn :  (加 -U 表示 Upgrade)

pi@raspberrypi:~ $ sudo pip install scikit-learn -U
Downloading/unpacking scikit-learn
  Downloading scikit-learn-0.18.1.tar.gz (8.9MB): 8.9MB downloaded
  Running setup.py (path:/tmp/pip-build-A9tWvA/scikit-learn/setup.py) egg_info for package scikit-learn
    Partial import of sklearn during the build process.

Installing collected packages: scikit-learn
  Running setup.py install for scikit-learn
    Partial import of sklearn during the build process.
    blas_opt_info:
    blas_mkl_info:
      libraries mkl,vml,guide not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
      NOT AVAILABLE

    openblas_info:
      libraries  not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
      NOT AVAILABLE

    atlas_blas_threads_info:
    Setting PTATLAS=ATLAS
      libraries ptf77blas,ptcblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
      NOT AVAILABLE

    atlas_blas_info:
      libraries f77blas,cblas,atlas not found in ['/usr/local/lib', '/usr/lib', '/usr/lib/arm-linux-gnueabihf']
      NOT AVAILABLE

    /usr/lib/python2.7/dist-packages/numpy/distutils/system_info.py:1521: UserWarning:
        Atlas (http://math-atlas.sourceforge.net/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [atlas]) or by setting
        the ATLAS environment variable.
      warnings.warn(AtlasNotFoundError.__doc__)
    blas_info:
      FOUND:
        libraries = ['blas']
        library_dirs = ['/usr/lib']
        language = f77

      FOUND:
        libraries = ['blas']
        library_dirs = ['/usr/lib']
        define_macros = [('NO_ATLAS_INFO', 1)]
        language = f77

    sklearn/setup.py:72: UserWarning:
        Blas (http://www.netlib.org/blas/) libraries not found.
        Directories to search for the libraries can be specified in the
        numpy/distutils/site.cfg file (section [blas]) or by setting
        the BLAS environment variable.
      warnings.warn(BlasNotFoundError.__doc__)
    unifing config_cc, config, build_clib, build_ext, build commands --compiler options
    unifing config_fc, config, build_clib, build_ext, build commands --fcompiler options
    build_src
    building library "libsvm-skl" sources
    building library "cblas" sources
    building extension "sklearn.__check_build._check_build" sources
    building extension "sklearn.cluster._dbscan_inner" sources
    building extension "sklearn.cluster._hierarchical" sources
    building extension "sklearn.cluster._k_means_elkan" sources
    building extension "sklearn.cluster._k_means" sources
    building extension "sklearn.datasets._svmlight_format" sources
    building extension "sklearn.decomposition._online_lda" sources
    building extension "sklearn.decomposition.cdnmf_fast" sources
    building extension "sklearn.ensemble._gradient_boosting" sources
    building extension "sklearn.feature_extraction._hashing" sources
    building extension "sklearn.manifold._utils" sources
    building extension "sklearn.manifold._barnes_hut_tsne" sources
    building extension "sklearn.metrics.pairwise_fast" sources
    building extension "sklearn.metrics/cluster.expected_mutual_info_fast" sources
    building extension "sklearn.neighbors.ball_tree" sources
    building extension "sklearn.neighbors.kd_tree" sources
    building extension "sklearn.neighbors.dist_metrics" sources
    building extension "sklearn.neighbors.typedefs" sources
    building extension "sklearn.tree._tree" sources
    building extension "sklearn.tree._splitter" sources
    building extension "sklearn.tree._criterion" sources
    building extension "sklearn.tree._utils" sources
    building extension "sklearn.svm.libsvm" sources
    building extension "sklearn.svm.liblinear" sources
    building extension "sklearn.svm.libsvm_sparse" sources
    building extension "sklearn._isotonic" sources
    building extension "sklearn.linear_model.cd_fast" sources
    building extension "sklearn.linear_model.sgd_fast" sources
    building extension "sklearn.linear_model.sag_fast" sources
    building extension "sklearn.utils.sparsetools._traversal" sources
    building extension "sklearn.utils.sparsetools._graph_tools" sources
    building extension "sklearn.utils.sparsefuncs_fast" sources
    building extension "sklearn.utils.arrayfuncs" sources
    building extension "sklearn.utils.murmurhash" sources
    building extension "sklearn.utils.lgamma" sources
    building extension "sklearn.utils.graph_shortest_path" sources
    building extension "sklearn.utils.fast_dict" sources
    building extension "sklearn.utils.seq_dataset" sources
    building extension "sklearn.utils.weight_vector" sources
    building extension "sklearn.utils._random" sources
    building extension "sklearn.utils._logistic_sigmoid" sources
    building data_files sources
    build_src: building npy-pkg config files
    customize UnixCCompiler
    customize UnixCCompiler using build_clib
    building 'libsvm-skl' library
    compiling C++ sources
    C compiler: c++ -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC

    compile options: '-I/usr/lib/python2.7/dist-packages/numpy/core/include -c'
    c++: sklearn/svm/src/libsvm/libsvm_template.cpp
    arm-linux-gnueabihf-gcc-ar: adding 1 object files to build/temp.linux-armv6l-2.7/liblibsvm-skl.a
    building 'cblas' library
    compiling C sources
    C compiler: arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC

    compile options: '-I/usr/lib/python2.7/dist-packages/numpy/core/include -c'
    arm-linux-gnueabihf-gcc: sklearn/src/cblas/ATL_drefasum.c
    arm-linux-gnueabihf-gcc: sklearn/src/cblas/cblas_dcopy.c
    sklearn/src/cblas/cblas_dcopy.c: In function ‘cblas_dcopy’:
    sklearn/src/cblas/cblas_dcopy.c:46:10: warning: implicit declaration of function ‘ATL_drefcopy’ [-Wimplicit-function-declaration]
              if (incY < 0) ATL_dcopy(N, X, -incX, Y, -incY);
              ^
    In file included from sklearn/src/cblas/cblas_dcopy.c:32:0:
    sklearn/src/cblas/cblas_dcopy.c: At top level:
    sklearn/src/cblas/atlas_misc.h:393:12: warning: ‘ATL_AlignOffset’ defined but not used [-Wunused-function]
     static int ATL_AlignOffset
                ^
    sklearn/src/cblas/atlas_misc.h:409:14: warning: ‘ATL_Align2Ptr’ defined but not used [-Wunused-function]
     static void *ATL_Align2Ptr(const void *pu, const void *pA)
                  ^
    arm-linux-gnueabihf-gcc: sklearn/src/cblas/cblas_srot.c
    In file included from sklearn/src/cblas/cblas_srot.c:32:0:
    sklearn/src/cblas/atlas_misc.h:393:12: warning: ‘ATL_AlignOffset’ defined but not used [-Wunused-function]
     static int ATL_AlignOffset
                ^
    sklearn/src/cblas/atlas_misc.h:409:14: warning: ‘ATL_Align2Ptr’ defined but not used [-Wunused-function]
     static void *ATL_Align2Ptr(const void *pu, const void *pA)
                  ^
......
......
(還有很多 warning)
......
......
......
    In file included from /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/ufuncobject.h:327:0,
                     from sklearn/utils/_logistic_sigmoid.c:294:
    /usr/lib/python2.7/dist-packages/numpy/core/include/numpy/__ufunc_api.h:241:1: warning: _import_umath defined but not used [-Wunused-function]
     _import_umath(void)
     ^
    arm-linux-gnueabihf-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-armv6l-2.7/sklearn/utils/_logistic_sigmoid.o -Lbuild/temp.linux-armv6l-2.7 -lm -o build/lib.linux-armv6l-2.7/sklearn/utils/_logistic_sigmoid.so

Successfully installed scikit-learn
Cleaning up...

呼! 好久, 但終於成功了.

5.安裝 ipython ipython-notebook :  

pi@raspberrypi:~ $ sudo apt-get install ipython  
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  python-pexpect python-simplegeneric
Suggested packages:
  ipython-doc ipython-notebook ipython-qtconsole python-zmq python-pexpect-doc
The following NEW packages will be installed:
  ipython python-pexpect python-simplegeneric
0 upgraded, 3 newly installed, 0 to remove and 7 not upgraded.
Need to get 667 kB of archives.
After this operation, 3,390 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-pexpect all 3.2-1 [38.4 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-simplegeneric all 0.8.1-1 [11.9 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main ipython all 2.3.0-2 [616 kB]
Fetched 667 kB in 7s (88.9 kB/s)
Selecting previously unselected package python-pexpect.
(Reading database ... 126268 files and directories currently installed.)
Preparing to unpack .../python-pexpect_3.2-1_all.deb ...
Unpacking python-pexpect (3.2-1) ...
Selecting previously unselected package python-simplegeneric.
Preparing to unpack .../python-simplegeneric_0.8.1-1_all.deb ...
Unpacking python-simplegeneric (0.8.1-1) ...
Selecting previously unselected package ipython.
Preparing to unpack .../ipython_2.3.0-2_all.deb ...
Unpacking ipython (2.3.0-2) ...
Processing triggers for gnome-menus (3.13.3-6) ...
Processing triggers for desktop-file-utils (0.22-1) ...
Processing triggers for mime-support (3.58) ...
Processing triggers for hicolor-icon-theme (0.13-1) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up python-pexpect (3.2-1) ...
Setting up python-simplegeneric (0.8.1-1) ...
Setting up ipython (2.3.0-2) ...

6.安裝 ipython-notebook :

pi@raspberrypi:~ $ sudo apt-get install ipython-notebook
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  fonts-font-awesome fonts-mathjax ipython-notebook-common libjs-highlight libjs-highlight.js libjs-marked libjs-mathjax
  libjs-underscore libpgm-5.1-0 libsodium13 libzmq3 python-jinja2 python-markupsafe python-mysqldb python-pycurl python-tornado
  python-zmq
Suggested packages:
  python-pygments pandoc pgf fonts-stix fonts-mathjax-extras libjs-mathjax-doc python-jinja2-doc python-egenix-mxdatetime
  python-mysqldb-dbg libcurl4-gnutls-dev python-pycurl-dbg python-pycurl-doc
The following NEW packages will be installed:
  fonts-font-awesome fonts-mathjax ipython-notebook ipython-notebook-common libjs-highlight libjs-highlight.js libjs-marked
  libjs-mathjax libjs-underscore libpgm-5.1-0 libsodium13 libzmq3 python-jinja2 python-markupsafe python-mysqldb python-pycurl
  python-tornado python-zmq
0 upgraded, 18 newly installed, 0 to remove and 18 not upgraded.
Need to get 9,068 kB of archives.
After this operation, 52.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrordirector.raspbian.org/raspbian/ jessie/main libsodium13 armhf 1.0.0-1 [143 kB]
Get:2 http://mirrordirector.raspbian.org/raspbian/ jessie/main libpgm-5.1-0 armhf 5.1.118-1~dfsg-1 [153 kB]
Get:3 http://mirrordirector.raspbian.org/raspbian/ jessie/main libzmq3 armhf 4.0.5+dfsg-2+deb8u1 [418 kB]
Get:4 http://mirrordirector.raspbian.org/raspbian/ jessie/main fonts-font-awesome all 4.2.0~dfsg-1 [346 kB]
Get:5 http://mirrordirector.raspbian.org/raspbian/ jessie/main fonts-mathjax all 2.4-2 [960 kB]
Get:6 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjs-highlight.js all 8.2+ds-4 [165 kB]
Get:7 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjs-highlight all 8.2+ds-4 [22.3 kB]
Get:8 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjs-marked all 0.3.2+dfsg-1 [12.6 kB]
Get:9 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjs-mathjax all 2.4-2 [5,333 kB]
Get:10 http://mirrordirector.raspbian.org/raspbian/ jessie/main libjs-underscore all 1.7.0~dfsg-1 [49.9 kB]
Get:11 http://mirrordirector.raspbian.org/raspbian/ jessie/main ipython-notebook-common all 2.3.0-2 [724 kB]
Get:12 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-markupsafe armhf 0.23-1 [15.7 kB]
Get:13 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-jinja2 all 2.7.3-1 [170 kB]
Get:14 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-pycurl armhf 7.19.5-3 [48.7 kB]
Get:15 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-tornado armhf 3.2.2-1.1 [227 kB]
Get:16 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-zmq armhf 14.4.0-1 [173 kB]
Get:17 http://mirrordirector.raspbian.org/raspbian/ jessie/main ipython-notebook all 2.3.0-2 [48.1 kB]
Get:18 http://mirrordirector.raspbian.org/raspbian/ jessie/main python-mysqldb armhf 1.2.3-2.1 [59.2 kB]
Fetched 9,068 kB in 32s (279 kB/s)
Selecting previously unselected package libsodium13:armhf.
(Reading database ... 139736 files and directories currently installed.)
Preparing to unpack .../libsodium13_1.0.0-1_armhf.deb ...
Unpacking libsodium13:armhf (1.0.0-1) ...
Selecting previously unselected package libpgm-5.1-0.
Preparing to unpack .../libpgm-5.1-0_5.1.118-1~dfsg-1_armhf.deb ...
Unpacking libpgm-5.1-0 (5.1.118-1~dfsg-1) ...
Selecting previously unselected package libzmq3:armhf.
Preparing to unpack .../libzmq3_4.0.5+dfsg-2+deb8u1_armhf.deb ...
Unpacking libzmq3:armhf (4.0.5+dfsg-2+deb8u1) ...
Selecting previously unselected package fonts-font-awesome.
Preparing to unpack .../fonts-font-awesome_4.2.0~dfsg-1_all.deb ...
Unpacking fonts-font-awesome (4.2.0~dfsg-1) ...
Selecting previously unselected package fonts-mathjax.
Preparing to unpack .../fonts-mathjax_2.4-2_all.deb ...
Unpacking fonts-mathjax (2.4-2) ...
Selecting previously unselected package libjs-highlight.js.
Preparing to unpack .../libjs-highlight.js_8.2+ds-4_all.deb ...
Unpacking libjs-highlight.js (8.2+ds-4) ...
Selecting previously unselected package libjs-highlight.
Preparing to unpack .../libjs-highlight_8.2+ds-4_all.deb ...
Unpacking libjs-highlight (8.2+ds-4) ...
Selecting previously unselected package libjs-marked.
Preparing to unpack .../libjs-marked_0.3.2+dfsg-1_all.deb ...
Unpacking libjs-marked (0.3.2+dfsg-1) ...
Selecting previously unselected package libjs-mathjax.
Preparing to unpack .../libjs-mathjax_2.4-2_all.deb ...
Unpacking libjs-mathjax (2.4-2) ...
Selecting previously unselected package libjs-underscore.
Preparing to unpack .../libjs-underscore_1.7.0~dfsg-1_all.deb ...
Unpacking libjs-underscore (1.7.0~dfsg-1) ...
Selecting previously unselected package ipython-notebook-common.
Preparing to unpack .../ipython-notebook-common_2.3.0-2_all.deb ...
Unpacking ipython-notebook-common (2.3.0-2) ...
Selecting previously unselected package python-markupsafe.
Preparing to unpack .../python-markupsafe_0.23-1_armhf.deb ...
Unpacking python-markupsafe (0.23-1) ...
Selecting previously unselected package python-jinja2.
Preparing to unpack .../python-jinja2_2.7.3-1_all.deb ...
Unpacking python-jinja2 (2.7.3-1) ...
Selecting previously unselected package python-pycurl.
Preparing to unpack .../python-pycurl_7.19.5-3_armhf.deb ...
Unpacking python-pycurl (7.19.5-3) ...
Selecting previously unselected package python-tornado.
Preparing to unpack .../python-tornado_3.2.2-1.1_armhf.deb ...
Unpacking python-tornado (3.2.2-1.1) ...
Selecting previously unselected package python-zmq.
Preparing to unpack .../python-zmq_14.4.0-1_armhf.deb ...
Unpacking python-zmq (14.4.0-1) ...
Selecting previously unselected package ipython-notebook.
Preparing to unpack .../ipython-notebook_2.3.0-2_all.deb ...
Unpacking ipython-notebook (2.3.0-2) ...
Selecting previously unselected package python-mysqldb.
Preparing to unpack .../python-mysqldb_1.2.3-2.1_armhf.deb ...
Unpacking python-mysqldb (1.2.3-2.1) ...
Processing triggers for fontconfig (2.11.0-6.3+deb8u1) ...
Setting up libsodium13:armhf (1.0.0-1) ...
Setting up libpgm-5.1-0 (5.1.118-1~dfsg-1) ...
Setting up libzmq3:armhf (4.0.5+dfsg-2+deb8u1) ...
Setting up fonts-font-awesome (4.2.0~dfsg-1) ...
Setting up fonts-mathjax (2.4-2) ...
Setting up libjs-highlight.js (8.2+ds-4) ...
Setting up libjs-highlight (8.2+ds-4) ...
Setting up libjs-marked (0.3.2+dfsg-1) ...
Setting up libjs-mathjax (2.4-2) ...
Setting up libjs-underscore (1.7.0~dfsg-1) ...
Setting up ipython-notebook-common (2.3.0-2) ...
Setting up python-markupsafe (0.23-1) ...
Setting up python-jinja2 (2.7.3-1) ...
Setting up python-pycurl (7.19.5-3) ...
Setting up python-tornado (3.2.2-1.1) ...
Setting up python-zmq (14.4.0-1) ...
Setting up ipython-notebook (2.3.0-2) ...
Setting up python-mysqldb (1.2.3-2.1) ...
Processing triggers for libc-bin (2.19-18+deb8u7) ...

最後用 pip list 查看已安裝的套件 :

pi@raspberrypi:~ $ pip list
argparse (1.2.1)
beautifulsoup4 (4.3.2)
chardet (2.3.0)
colorama (0.3.2)
decorator (3.4.0)
gpiozero (1.3.2)
html5lib (0.999)
ipython (2.3.0)
joblib (0.8.3)
lxkeymap (0.1)
matplotlib (1.4.2)
mcpi (0.1.1)
mock (1.0.1)
ndg-httpsclient (0.3.2)
nose (1.3.4)
numexpr (2.4)
numpy (1.8.2)
openpyxl (1.7.0)
pandas (0.14.1)
pexpect (3.2)
picamera (1.13)
pifacecommon (4.2.1)
pifacedigitalio (3.1.0)
Pillow (2.6.1)
pip (1.5.6)
pyasn1 (0.1.7)
pygame (1.9.2a0)
pygobject (3.14.0)
pyOpenSSL (0.13.1)
pyparsing (2.0.3)
pyserial (2.6)
python-dateutil (2.2)
pytz (2012c)
requests (2.4.3)
RPi.GPIO (0.6.3)
RTIMULib (7.2.1)
scikit-learn (0.18.1)
scipy (0.14.0)
sense-hat (2.2.0)
setuptools (5.5.1)
simplegeneric (0.8.1)
simplejson (3.6.5)
six (1.8.0)
spidev (3.0)
statsmodels (0.4.2)
tables (3.1.1)
urllib3 (1.9.1)
wheel (0.24.0)
wsgiref (0.1.2)
xlrd (0.9.2)
xlwt (0.7.5)

現在我的樹莓派上不管是 Python2 或 Python3 環境都有 scikit-learn 與相關套件了. 完成後又重新做一次映像檔.


沒有留言:

張貼留言