Prepend folder to PATH

I want to append my anaconda folder to the beginning of $PATH so that I can use python and pip from Ananconda

Here is my ~/.profile:

if [ -n "$BASH_VERSION" ]; then # include .bashrc if it exists if [ -f "$HOME/.bashrc" ]; then . "$HOME/.bashrc" fi
fi
# set PATH so it includes user's private bin directories
export PATH=$HOME/bin:$HOME/.local/bin:$PATH
export PATH=$HOME/opt/anaconda3/bin:$PATH
export PATH=$PATH:$HOME/opt/node-v6.9.1-linux-x64/bin
export PATH=$PATH:$HOME/opt/mongodb-linux-x86_64-ubuntu1604-3.2.10/bin
export PATH=$PATH:/usr/local/heroku/bin

However, when I print out echo $PATH, the PATH always begins with /usr/local/bin:/usr/local/sbin so that I have to use /usr/local/bin/pip instead of pip from my anaconda folder. How can I fix it?

Here is my PATH

/usr/local/bin:/usr/local/sbin:/home/USERNAME/opt/anaconda3/bin:...

By the way, I use zsh instead of bash.

1

1 Answer

zsh doesn't use .profile it uses .zshrc or .zprofile

also you need to change your PATH exports to prepend not postfix

export PATH=:/usr/local/heroku/bin:$PATH
1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like