Open4

ML的 mac 環境構築 2021

fifififi

macのマルチユーザ環境でML的環境構築方法の整理.

fifififi

複数のログインユーザがいる場合の環境構築方法の整理

$HOME直下に色々とインストールするためのメモ

Homebrew

ユーザ環境($HOME配下)にHomebrewをインストール

# 実行ファイルの解答
cd ~
mkdir homebrew && curl -L https://github.com/Homebrew/brew/tarball/master | tar xz --strip 1 -C homebrew

# ※ デフォルトシェルにパスを通す作業が必要

ひとまずよく使うツールをインストール

brew install tree bat fish starship tmux htop glances

terminal

fish

インストール

brew install fish
brew install starship

デフォルトシェルに設定

# change shecll
chsh -s $HOME/homebrew/bin/fish

# /etc/shellsに登録
echo $HOME/homebrew/bin/fish | sudo tee -a /etc/shells

~/.config/fish/config.fish


# Path
# Install to user
set PATH $PATH $HOME/homebrew/bin

# Prompt
# > brew install starship
starship init fish | source

# pyenv
# > brew install pyenv
set -Ux PYENV_ROOT $HOME/.pyenv
set -U fish_user_paths $PYENV_ROOT/bin $fish_user_paths
status is-interactive; and pyenv init --path | source

# pipenv
# > pip install --user pipenv
set -Ux PIPENV_VENV_IN_PROJECT 1
set PATH $PATH $HOME/.local/bin

# Alias
alias c="clear"
fifififi

python 環境構築

  • 注意することロコはpipenvを--user環境に入れることだけ
  • M1だとpipでpandasが入らなかったのでソースからインストールしている
# pyenv
# (* brewはuser homeにインストールしてください)
brew install pyenv

# pipenv 
pip3 install --user pipenv # --user で入れる
pipenv install --three

# jupyter
pipenv install jupyter

# Pandas
pipenv shell
pip install numpy cython
git clone https://github.com/pandas-dev/pandas.git
cd pandas
python3 setup.py install

# そのたパッケージ
pip install sklearn seaborn
pip install matplotlib japanize-matplotlib
pip install tqdm

fifififi

ユーザグループについて

  • 今回はユーザのグループ機能は使っていない。
  • グループを使うことで、permissionまわりが解決するのかもしれない。
  • 未調査