-1

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?

tripleee
  • 175,061
  • 34
  • 275
  • 318
JR2018
  • 1
  • 1
  • 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?](https://stackoverflow.com/questions/36313216/why-is-testing-to-see-if-a-command-succeeded-or-not-an-anti-pattern)) – tripleee Aug 28 '22 at 06: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`. – user1934428 Aug 29 '22 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` – user1934428 Aug 31 '22 at 09: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. – Marlon Richert Sep 03 '22 at 08: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 ) ''' – JR2018 Sep 04 '22 at 09:12
  • In that case, try commenting out lines from your `.zshrc` file until you find what’s actually causing the problem. – Marlon Richert Sep 04 '22 at 15:20
  • You need to update your question with a minimal, reproducible example: https://stackoverflow.com/help/minimal-reproducible-example – Marlon Richert Sep 04 '22 at 15:21

1 Answers1

0

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
jodave
  • 11
  • 1