Multiple versions of Python on a Mac

时间:2018-06-04 16:50:57

标签: python homebrew

I have installed multiple versions of Python. Currently when I do which Python - I believe it still points to the default version of the Python and not to the one that's installed by python2.7.

When I try python2.7 it shows a different location of python2.7

PMs-MBP:~ prem$ which python
/usr/local/bin/python
PMs-MBP:~ prem$ which python python2.7
/usr/local/bin/python
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7

What should I change to point the default version (Python) to homebrew version?

I tried to link using the below command but get the below error:

PMs-MBP:~ prem$ brew link python2.7
Error: No such keg: /usr/local/Cellar/python2.7

2 个答案:

答案 0 :(得分:0)

I had a similar issue in linux, i just uninstall python27 and remained with python34.

答案 1 :(得分:0)

Use brew install python2 to link and install Python2. Then /usr/local/bin/python and /usr/local/bin/python2.7 will be the Homebrew installed version.