pandasでデータの相関分析 Mac (準備)
まずはpandasのインストールから。
brew install pyenv
でエラーが出たので、MacOSをHigh Sierraにアップデート。
もう一度、pandasのインストール。
$ brew install pyenv
Warning: You are using OS X 10.13.
We do not provide support for this pre-release version.
You may encounter build failures or other breakage.
とのこと。
$ brew install python3
でも同じような結果になった。
brewのアップデート。。。
$ brew update
warning: unable to unlink .yardopts: Permission denied
warning: unable to unlink CONTRIBUTING.md: Permission denied
warning: unable to unlink SUPPORTERS.md: Permission denied
fatal: cannot create directory at '.github': Permission denied
Error: Failure while executing: git pull -q origin refs/heads/master:refs/remotes/origin/master
これもエラー。
$ cd $(brew --prefix)
$ pwd
/usr/local
$ sudo chown -R $USER $(brew --prefix)
$ sudo chown -R $USER $(brew --prefix)
chown: /usr/local: Operation not permitted
$ sudo chown -R $(whoami) $(brew --prefix)/*
としたらコマンドは通ったが解決していない。
macOS High Sierra で Ansible 入れようとしたら失敗した。
に書いてあったが、High Sierra では上記操作ができない。
$ git fetch --all
$ git fetch --all
Fetching origin
$ git reset --hard origin/master
$ git reset --hard origin/master
warning: unable to unlink .yardopts: Permission denied
warning: unable to unlink CONTRIBUTING.md: Permission denied
warning: unable to unlink SUPPORTERS.md: Permission denied
fatal: cannot create directory at '.github': Permission denied
本当は、chownを1つずつ実行すれば良かったらしいが、
brewの再インストールをしてしまった。。
brewを再インストール。
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
再び、Python3をインストールを試す。
$ brew install python3
$ which python3
/usr/local/bin/python3
ようやくできるようになった。
$ brew install pyenv
$ export PYENV_ROOT="$HOME/.pyenv"
$ export PATH="$PYENV_ROOT/bin:$PATH"
$ eval "$(pyenv init -)"
バージョンチェック。
$ pyenv install --list
3.7.0が最新の様だった。
pyenvとは、複数バージョンのPythonを簡単に切り替えられるツールらしい。
$ pyenv versions
* system (set by /Users/masahiro/.pyenv/version)
3.7.0
pipを使ってパッケージをインストールする。
$ easy_install pip
$ pip list
Package Version
---------- -------
pip 10.0.1
setuptools 39.0.1
$ pip install pandas
Collecting pandas
Collecting python-dateutil>=2.5.0 (from pandas)
Collecting pytz>=2011k (from pandas)
Collecting numpy>=1.9.0 (from pandas)
Installing collected packages: six, python-dateutil, pytz, numpy, pandas
Successfully installed numpy-1.14.5 pandas-0.23.3 python-dateutil-2.7.3 pytz-2018.5 six-1.11.0
$ pip install scipy
$ pip install pyparsing
$ pip install freetype-py
$ pip install scikit-learn
$ pip install django
$ pip install tornado
$ pip freeze
Django==2.0.7
freetype-py==2.0.0.post6
numpy==1.14.5
pandas==0.23.3
pyparsing==2.2.0
python-dateutil==2.7.3
pytz==2018.5
scikit-learn==0.19.2
scipy==1.1.0
six==1.11.0
tornado==5.1
よし、これで準備が出来た。