Search code examples
shellzshpyenv

"command not found: pyenv" when called by zsh script


I have made a launcher on my xubuntu desktop which calls a script named dev_blog.sh.

dev_blog.sh contains :

#!/usr/bin/zsh
echo ça marche
pyenv activate zinnia
/usr/bin/zsh

When I call the launcher from the desktop, my terminal opens and I can read :

dev_blog.sh:3: command not found: pyenv

Whereas when I type the same line in the same terminal, it works.

Here's the content of my .zshrc :

export ZSH=/home/proph73/.oh-my-zsh
ZSH_THEME="agnoster"
PATH="$HOME/bin:$HOME/.local/bin:$PATH"
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
source $ZSH/oh-my-zsh.sh`

Solution

  • PATH="$HOME/bin:$HOME/.local/bin:$PATH" move this to your .profile or use the full path to the executable in your shortcut $(which pyenv)