[Python] Pyenv duplicating line over and over again in .bashrc and .profile

Discussão em 'Python' iniciado por Stack, Maio 14, 2025.

  1. Stack

    Stack Membro Participativo

    I installed pyenv yesterday, and I came back today and noticed my terminal was opening slower than usual, so I check my .bashrc and find over 10 lines of the following code:

    export PYENV_ROOT="$HOME/.pyenv"
    [[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
    eval "$(pyenv init - bash)"


    Same thing on .profile. I followed the installation guide on Github, so I'm not sure what I did wrong. It duplicates every time I re-open the terminal or a new terminal, not when I do exec bash or exec $SHELL. These were the lines I copied into .bashrc and .profile.

    .profile:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.profile
    echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.profile
    echo 'eval "$(pyenv init - bash)"' >> ~/.profile


    .bashrc:

    echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
    echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
    echo 'eval "$(pyenv init - bash)"' >> ~/.bashrc


    I use Ubuntu with WSL. If anybody knows how to fix this I'd really appreciate it.

    Continue reading...

Compartilhe esta Página