LoginSignup
16
10

More than 1 year has passed since last update.

install numpy, scipy, matplotlib and pandas on pyenv in M1 Mac

Last updated at Posted at 2021-08-08

MacOS (Apple silicon M1; arm64) 上のPython(pyenv)でnumpy, scipy, matplotlib, pandas をインストールしたメモ。

基本的にscipy以外は苦労しない。

ref.)
https://github.com/scipy/scipy/issues/13409

準備

  • Homebrew を使えるようにしておく
  • pyenv を使えるようにしておく

Python3.9以上をインストール

  • numpy用(本稿は3.9.6で確認)
$ brew install openssl readline sqlite3 xz zlib

$ pyenv install 3.9.6
$ pyenv local 3.9.6
  • libjpegmatplotlib のインストールに必要と思われる。
  • 最後の pyenv local は環境に応じて適宜変更のこと。

numpy

$ pip install numpy

scipy

$ export OPENBLAS=$(brew --prefix openblas)
$ export CFLAGS="-falign-functions=8 ${CFLAGS}"
$ pip install Cython pybind11 pythran
$ pip install --no-use-pep517 scipy

pandas

$ pip install pandas

matplotlib

$ brew install libjpeg
$ pip install matplotlib

errorやwarningが出る(詳しく見ていない)が、とりあえずimportはできる。

16
10
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
16
10