Mac向けです。
brewはインストール済みの前提で進めます。
pyenvインストール
macOS Catalina zsh環境でpyenvを使ってPython 3.9.0をインストール
コマンド - Poetry documentation (日本語訳)
$ brew install pyenv
.zshrcに追記
export PYENV_ROOT="$HOME/.pyenv" export PATH="$PYENV_ROOT/bin:$PATH" eval "$(pyenv init -)"
インストール可能なバージョン一覧を確認、インストール
$ pyenv install --list $ pyenv install 3.9.4 $ pyenv global 3.9.4
Poetryインストール
M1 Macにpyenv+Poetryをインストールする | mktia's note
$ curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python -
作成済みのリポジトリの場合
$ cd ${path} $ poetry init
新しくリポジトリを作る場合
$ poetry new ${path}
IntelliJでPoetryを使う
- Poetryのプラグイン をインストールする
- File > Project Structureを開く
- Project Settings -> Project を開く
- Project SDK -> Add SDK -> Python SDKを開く
- Poetry Environment -> Existing Environment Interpreterから利用したいvenvを指定
- Run > Edit Configrations > +(Add New Configrations)
- Pythonを選択
- Configration > Script Pathでアプリケーションのエントリポイントを指定