简体   繁体   中英

OSX Terminal opens default Python instead of Anaconda

I've always used python with the terminal, and by typing python it would open Python 3.5 Anaconda, where I have saved many libraries that I usually need. Early today I tried installing something and I must've messed up because now it always opens Python 2.7 Default. I Googled and searched over here and many suggested to modify the bash_profile, which I did many times. If I type export PATH=~/anaconda/bin:"$PATH" in the terminal it opens correctly the Anaconda version of Python, but every time I reopen the terminal I have to type it again. As I said, I tried to modify the bash profile putting export PATH=~/anaconda/bin:"$PATH" first, I tried doing source ~/.bash_profile , but still nothing. My bash profile right now is the following, it looks kind of messy because I tried some "variations".

bash profile

It looks to me like the problem might be the Homebrew part of your profile at the bottom.

It puts /usr/local/bin/ at the front of the path.

which python would tell you which python you are about to get. And echo $PATH will tell you the overall path you're about to use. Post the results of those.

So from your comments you're running the python from Homebrew and you need to move that part of your profile to the top.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM