2020/05/27時点ではもうWindows 64bitのpythonでも問題なくnumpyやsklearnがpip installできる。
pip install sklearnだけ実行するとnumpyとかscipyもインストールしてくれる。
> python --version
Python 3.8.2
> pip install sklearn
Requirement already satisfied: sklearn in c:\users\username\appdata\local\programs\python\python38\lib\site-packages (0.0)
Collecting scikit-learn
Using cached scikit_learn-0.23.1-cp38-cp38-win_amd64.whl (6.8 MB)
Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\username\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn->sklearn) (2.0.0)
Collecting scipy>=0.19.1
Using cached scipy-1.4.1-cp38-cp38-win_amd64.whl (31.0 MB)
Collecting numpy>=1.13.3
Using cached numpy-1.18.4-cp38-cp38-win_amd64.whl (12.8 MB)
Requirement already satisfied: joblib>=0.11 in c:\users\username\appdata\local\programs\python\python38\lib\site-packages (from scikit-learn->sklearn) (0.15.1)
Installing collected packages: numpy, scipy, scikit-learn
Successfully installed numpy-1.18.4 scikit-learn-0.23.1 scipy-1.4.1
> pip list
Package Version
------------- -------
numpy 1.18.4
pip 20.1.1
scikit-learn 0.23.1
scipy 1.4.1
sklearn 0.0
前提
anacondaを使わずに機械学習の環境を作りたかった。
32bit版でいいからscikit-learn環境をさくっと作ってまずは動かしたい人向けかな。
Windowsで64bit版のPythonやscikit-learnを揃える方法は別途整理できたら投稿する予定。
今回の環境
- Windows10 (64bit)
- git(python コマンドをgit bash上で実行)
- python-3.6.5.exe (32bit)
- numpy-1.14.2 (32bit)
- scipy-1.0.1 (32bit)
- scikit-learn-0.19.1 (32bit)
numpy
$ python -m pip install numpy
Collecting numpy
Downloading https://files.pythonhosted.org/packages/05/3f/39ec9e88b0a14930c70722f832861c2ef7bd4bbee9ed8d586c0c1dcb531b/numpy-1.14.2-cp36-none-win32.whl (9.8MB)
100% |████████████████████████████████| 9.8MB 107kB/s
Installing collected packages: numpy
Successfully installed numpy-1.14.2
scipy
$ pip install scipy
Collecting scipy
Downloading https://files.pythonhosted.org/packages/dc/ab/7f2d3a112635b59e1f275b0c14f512839b7d26e8c3bcadf5391a3eb74aba/scipy-1.0.1-cp36-none-win32.whl (26.0MB)
100% |████████████████████████████████| 26.0MB 806kB/s
Requirement already satisfied: numpy>=1.8.2 in c:\users\parkh\appdata\local\programs\python\python36-32\lib\site-packages (from scipy) (1.14.2)
Installing collected packages: scipy
Successfully installed scipy-1.0.1
scikit-learn
$ pip install scikit-learn
Collecting scikit-learn
Downloading https://files.pythonhosted.org/packages/87/b7/0e7f5c0cf765cf4e1924c068e7b2e1708c93ebffde9302a57ea8f26619e9/scikit_learn-0.19.1-cp36-cp36m-win32.whl (3.9MB)
100% |████████████████████████████████| 3.9MB 2.1MB/s
Installing collected packages: scikit-learn
Successfully installed scikit-learn-0.19.1
トラブル
$ pip install numpy-1.14.2+mkl-cp36-cp36m-win_amd64.whl
numpy-1.14.2+mkl-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.
PCが64bitだからと思ってnumpy 64bit版を入れるとエラーが出た。
python-3.6.5.exeは32bit版だったので整合性が合わずにエラー。
実は上述のようにシンプルにpip install numpy
でnumpy 32bit版がインストールできた。
苦労して64bit版を探してくる必要がなかったが、
性能など考えた場合はそのうち使うだろう。
注意
PythonのDownloadページで「Download Python 3.6.5」をクリックすると32bit版がダウンロードされる。