DEV Community

Fabricio
Fabricio

Posted on

How to fix 'zsh: command not found: python' when using pyenv on macos

  1. Start by installing pyenv via brew brew install pyenv
  2. Install desired version of python pyenv install <version> and set it as global pyenv global <version>
  3. Update the environment variables to use the version of Python installed through pyenv: echo 'export PATH="$HOME/.pyenv/bin:$PATH"' >> ~/.zshrc
  4. Restart your terminal or run the following command: source ~/.zshrc
  5. Alias python installed via pyenv echo "alias python=$(pyenv which python)" >> ~/.zshrc

Top comments (0)