Skip to content

Instantly share code, notes, and snippets.

@whchi
Last active December 2, 2025 12:40
Show Gist options
  • Select an option

  • Save whchi/c7fd367cb02243bbeffd44d801f10795 to your computer and use it in GitHub Desktop.

Select an option

Save whchi/c7fd367cb02243bbeffd44d801f10795 to your computer and use it in GitHub Desktop.
# 1. 安裝 pyenv(用 Homebrew,超簡單)
brew install pyenv
# 2. 加入 pyenv 到你的 shell(zsh,macOS 預設)
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.zshrc
echo 'command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.zshrc
echo 'eval "$(pyenv init -)"' >> ~/.zshrc
source ~/.zshrc
# 3. 安裝 Python 2.7.18(pyenv 會自動偵測 arm64 並編譯,過程約 2-5 分鐘)
pyenv install 2.7.18
# 4. 驗證安裝
pyenv versions # 應該看到 2.7.18
~/.pyenv/versions/2.7.18/bin/python --version # 顯示 Python 2.7.18
# 5. 找到完整路徑並設定給 yarn
yarn config set python "$(pyenv prefix 2.7.18)/bin/python"
# 6. 設定 project use python
pyenv local 2.7.18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment