0

Whenever I launch iTerm2 w/zsh i get the following message:

WARNING: python binary not found on PATH.
zsh-autoswitch-virtualenv plugin will be disabled.

If i type this i get the following path:

~ ❯ echo $PATH                                                 

/Users/macm1/opt/anaconda3/bin:/Users/macm1/opt/anaconda3/condabin:/usr/local/bin:/Users/macm1/Library/Python/3.8/bin:/Users/macm1/.pyenv/bin:/Users/macm1/.pyenv/bin:/opt/local/bin:/opt/local/sbin:/opt/homebrew/bin:/opt/homebrew/sbin:/Library/Frameworks/Python.framework/Versions/3.10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:~/.dotnet/tools:/Library/Apple/usr/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Users/macm1/.fig/bin:/Users/macm1/.local/bin:/Users/macm1/.local/bin:/Users/macm1/.local/bin

Also:

~ ❯ which python3                                              
/Users/macm1/opt/anaconda3/bin/python3
~ ❯ python --version                                           
Python 3.9.7
~ ❯ ls -l /usr/bin/python                                      
"/usr/bin/python": No such file or directory (os error 2)

In my zsh shell i have the following:

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
#export PATH=/Library/Frameworks/Python.framework/Versions/3.8/bin:$PATH
export PATH=/Users/macm1/Library/Python/3.8/bin:$PATH

 # Created by `pipx`
export PATH="$PATH:/Users/macm1/.local/bin"

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!

__conda_setup="$('/Users/macm1/opt/anaconda3/bin/conda' 'shell.zsh' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/macm1/opt/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/macm1/opt/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/macm1/opt/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup

Can anyone assist with this?

7
  • 1
    Probably the error comes from within the __conda_setup assignment; can you please show us your troubleshooting efforts? Adding echo 'checkpoint 1' >&2 just before the call and a similar checkpoint 2 shortly after should help pinpoint this. (You can't put it immediately after because that will reset the value of $?. Tangentially, see also Why is testing ”$?” to see if a command succeeded or not, an anti-pattern?) Commented Aug 28, 2022 at 6:52
  • My guess is that some of the tools you use for initializing zsh, is trying to invoke Python as python instead of as python3. Commented Aug 29, 2022 at 10:21
  • Obviously you have defined something named python, but it is either not an executable, or if it is one, it is not located in /usr/bin. To find more about what your python really is, enter type -a python Commented Aug 31, 2022 at 9:30
  • Can you please add your entire .zshrc file to your question? The message you posted clearly states your are using the zsh-autoswitch-virtualenv plugin, yet it’s not visible anywhere in the code that you shared. Commented Sep 3, 2022 at 8:25
  • @marlonrichert the .zshrc is too long to post but the plugin appears in the plugins section ''' plugins=( zsh-history-enquirer zsh-aliases-exa git z github gitcd fast-syntax-highlighting zsh-autosuggestions auto-color-ls mistory update-plugin vscode autoswitch_virtualenv $plugins ) ''' Commented Sep 4, 2022 at 9:12

1 Answer 1

1

so, the problem is that "zsh-autoswitch-virtualenv plugin" is checking for python on ur system.

enter image description here

but you may have installed python3.

so to fix this, go to ur ~/.zshrc or ~/.bashrc file with vim or nano.

the add this lines at the top:

alias python=python3
alias pip=pip3
Sign up to request clarification or add additional context in comments.

1 Comment

I am using pyenv. Below answer helped me since aliasing makes the pyenv behave weirdly. stackoverflow.com/questions/71591971/…

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.