I use pyenv in my work and try to automate activation pyenv via bash script.
Normally i use below commands to activate it (it works well):
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv activate venv
I try to use bash script to automate it via bash script
Bash script (mybash_script)
#!/bin/bash
export PATH="$HOME/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"
pyenv activate venv
then i do
chmod +x ./mybash_script
But when i try to execute it - it doesn't activate pyenv. What i'm doing wrong why it is not working?