LoginSignup
41

More than 5 years have passed since last update.

macでpythonをアップデート

Posted at

macでpython3にアップデートする。
1、2はインストール済みの場合飛ばして構いません。

まずは

1.Homebrewをインストール

terminal
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2.pyenvをインストール

terminal
$ brew install pyenv

以下に追記。無ければ新規作成。

[起動shell]_profile
export PATH="$HOME/.pyenv/shims:$PATH"

3.pythonをインストール

pyenvでインストールできるPythonの確認。

terminal
$ pyenv install [最新バージョンを指定]
# 今回の自分の場合は以下を実行。
$ pyenv install 3.5.2

個別にモジュールをインストールするのが面倒くさいので、NumPy、SciPy、matplotlibなどの有名どこのモジュールを一括インストール。

terminal
$ pyenv install [anaconda最新バージョン]
# 自分の場合の例
$ pyenv install anaconda3-4.0.0

# インストールしたAnacondaを、Pythonのバージョンとして設定。
$ pyenv local [インストールしたanacondaのバージョン]
$ pyenv global [インストールしたanacondaのバージョン]

バージョン確認。

terminal
$ python -V

Python [バージョン] :: Anaconda バージョン
と表示されればOK.

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
41