Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

rjalex

macrumors 6502
Original poster
Mar 27, 2011
274
62
Rome, Italy
** SOLVED ** (see second post)

Hi guys, not sure what I've done but things aren't working as before.
pyenv global does not change the default python interpreter as it did before.
here's my setup:
pyenv 2.3.27 installed via brew
bob@Roberts-Mac-mini ~ % pyenv versions
system
* 2.7.18 (set by /Users/bob/.python-version)
3.10.13
3.11.5
bob@Roberts-Mac-mini ~ % pyenv global 3.10.13
bob@Roberts-Mac-mini ~ % pyenv versions

system
* 2.7.18 (set by /Users/bob/.python-version)
3.10.13
3.11.5
of course the latter should be pointing to 3.10.13
bob@Roberts-Mac-mini ~ % python3 --version
Python 3.11.5
bob@Roberts-Mac-mini ~ % python --version
Python 2.7.18
bob@Roberts-Mac-mini ~ % cat .zshrc
export PYENV_ROOT="$HOME/.pyenv"
command -v pyenv >/dev/null || export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init --path)"
eval "$(pyenv init -)"
export PATH="$PYENV_ROOT/shims:$PATH"
export PATH="/opt/homebrew/opt/openjdk/bin:$PATH"
export PATH="/opt/homebrew/bin:$PATH"

(.zprofile is the same and when it is sourced gives an error on lines 3 and 4:
Last login: Mon Sep 25 09:40:16 on ttys019
/Users/bob/.zprofile:3: command not found: pyenv
/Users/bob/.zprofile:4: command not found: pyenv

bob@Roberts-Mac-mini ~ % env (deleted unrelated lines and removed a few unrelated paths)
PATH=/Users/bob/opt/miniconda3/bin:/opt/homebrew/bin:/opt/homebrew/opt/openjdk/bin:/Users/bob/.pyenv/shims:/Users/bob/.pyenv/shims:/opt/homebrew/bin:/opt/homebrew/opt/openjdk/bin:/Users/bob/.pyenv/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
HOME=/Users/bob
PWD=/Users/bob
SHELL=/bin/zsh
SHLVL=1
OLDPWD=/Users/bob
PYENV_ROOT=/Users/bob/.pyenv
PYENV_SHELL=zsh
_=/usr/bin/env

I see some paths unnecessarily repeated and no idea why.

Can any eagle eyed developer understand why pyenv is not working as expected? Thanks in advance
 
Last edited:
NEVERMIND :) Found a solution after 1E03 attemtps :)

The problem is that I the pyenv shell VERSION overrides the pyenv global VERSION command and for some obscure reasons the PYENV_VERSION was set to Apple's 2.7 version and the global would not change it.

Once understood it was enough to issue a 'pyenv shell --unset' and all fell back to normal.

More docs: https://github.com/pyenv/pyenv/blob/master/COMMANDS.md#pyenv-shell
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.