LoginSignup
0
0

More than 1 year has passed since last update.

M1 MacにPython3をインストールする

Last updated at Posted at 2021-08-09

はじめに

Apple M1チップ搭載のMac Book ProにPython3をインストールした時のメモです。
今回はMiniforgeを利用しました。

やり方

Miniforgeとは最小限のCondaのインストーラーです。
さまざまはCPUアーキテクチャのサポートに重点を置いているので、新しいCPUアーキテクチャのPCにCondaを入れるときに最適です。
今回は直接ダウンロードする方法を紹介します。

1. Githubからダウンロードする。

ここからOS X arm64 (Apple Silicon)Miniforge3-MacOSX-arm64を選択してダウンロードします。

image.png

2. 以下をターミナルで実行します。ここではzshを選択しています。

選択肢は全てyesを選択します。

cd Downloads/
bash Miniforge3-MacOSX-arm64.sh

3. 赤線の部分のPathにある.bash_profileを開いて全てコピーする。

イラスト.png

Condaのインストールがうまくいっていれば以下のようなものが書き込まれているはずです。

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/***/miniforge3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/***/miniforge3/etc/profile.d/conda.sh" ]; then
        . "/Users/***/miniforge3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/***/miniforge3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

これを全てコピーします。

4. ~/.zsh_profile にコピーした内容を書き込む

vim ~/.zsh_profile 
source ~/.zsh_profile 

これで成功していれば以下を実行できるはずです。

conda -V

5. CondaでPythonをインストールする

conda create -n py3.8 python=3.8
conda activate py3.8

まとめ

Apple M1チップ搭載のMac Book ProにPython3をインストールしました。

0
0
0

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
0
0