1

I have two Python installations (both 2.7). One is connected with my Spyder IDE, and the other one is recognized in the terminal ("which python" directs me to its location). How can I remove the second one, and set the first one as the default python program in Mac.

My main problem is that when I use pip to install modules, I can't use them in the Spyder IDE.

Thanks.

Alt
  • 1,759
  • 5
  • 21
  • 30

1 Answers1

3

As explained here, changing the default python version is a bad idea since some applications depend on the original default python in Mac.

However, one reason why pip install might not be working for you, is that each version of python has its own pip version. So when you use pip install {pkg_name}, you are only installing the package on the particular python the default pip command is associated with.

You can check version of python the default pip command works with by doing: > pip --version in your terminal.

Try doing:

pip3 install {pkg_name}

Or:

pip2 install {pkg_name}

depending on which version of python Spyder IDE is using

Edit:

You can also more explicitly declare which pip to use by doing:

/full/path/to/python/version -m pip install {pkg_name}
Community
  • 1
  • 1
xgord
  • 3,719
  • 5
  • 24
  • 44
  • 2
    you can also `/full/path/to/python/version -m pip install` whatever – NightShadeQueen Jul 21 '15 at 16:57
  • Thanks for your answer, pip2 install {pkg_name} didn't solve the problem, and it seems like there is no pip3 in my computer. How can I find out which Python is being used by Spyder? – Alt Jul 21 '15 at 17:03
  • @NightShadeQueen good suggestion. I updated my answer to include it. – xgord Jul 21 '15 at 18:16
  • I had the wrong url for my previous comment. (now deleted) Corrected: The first part of this answer http://stackoverflow.com/a/20340173/2487336 says how to get pip for python3 installed. My guess is that Spyder uses Python3 since the default on mac is 2.7, but I'm not sure. – xgord Jul 21 '15 at 18:47