LoginSignup
2
3

More than 5 years have passed since last update.

Mac で xonsh と pyenv を使う

Last updated at Posted at 2019-01-17

Mac の環境

  • macOS Mojave v.10.14.2
  • Homebrew v.1.9.2
  • GNU bash v.5.0.0

Homebrew のインストール手順:
macOSにHomebrewをインストール

xonsh とは

Python 製のシェル
詳しい説明は以下のサイトにあります.
xonsh tutorial
Pythonistaに贈るXonshのススメ

pyenv とは

Python のバージョン管理システム
詳しい説明は以下のサイトにあります.
https://github.com/pyenv/pyenv

xonsh のインストール

以下のコマンドでインストール

brew update; brew upgrade
brew install python3 
brew install bash-completion2
pip3 install --upgrade pip
pip3 install xonsh gnureadline prompt-toolkit

以下のコマンドで起動

xonsh

pyenv のインストール

今回は Python 3.6.8 を使用
まず,.bash_profile に以下の内容を追加

.bash_profile
export PYENV_ROOT=/usr/local/var/pyenv
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi

次に,bash で以下のコマンドを実行し Python 3.6.8 をインストール

bash
brew install pyenv
source .bash_profile
sudo installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /
pyenv install 3.6.8

pyenv を使用して,Python 3.6.8 を設定

pyenv global 3.6.8

tips

.bash_profileの末尾に以下の内容を追加すると次から自動的に起動

.bash_profile
alias x="xonsh"
x

.xonshrc に関する詳しい説明は以下のサイトにあります.
xonshrcを書く

2
3
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
2
3