0

I have screwed up my python install on my MacOS machine.

Here it is -

REMs-MBP:opt rem$ which python
/usr/bin/python
REMs-MBP:opt rem$ python
-bash: /usr/local/opt/python/libexec/bin/python: No such file or directory
REMs-MBP:opt rem$ which python2
/Library/Frameworks/Python.framework/Versions/2.7/bin/python2
REMs-MBP:opt rem$ python2
Python 2.7.14 (v2.7.14:84471935ed, Sep 16 2017, 12:01:12) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.

python2 works fine but default python is not working fine.

How can I fix it?

brew install python by default tries to install python3. I need python2.7 as my default.


Updates:

pip still pointing to python3 installation.

PREMs-MBP:opt prem$ which python
/usr/bin/python
PREMs-MBP:opt prem$ pip
-bash: /usr/local/bin/pip: /usr/local/Cellar/python/3.7.0/bin/python3.7: bad interpreter: No such file or directory
GetHacked
  • 546
  • 4
  • 21
user1050619
  • 19,822
  • 85
  • 237
  • 413
  • Brew used to treat Python specially, but nowadays it treats Python the same as any other recipe. If you want an old version, you have to ask for it, with `brew install python@2`. – abarnert Jul 31 '18 at 02:14
  • But meanwhile, if you overwrote `/usr/bin/python` with something else, that can break parts of macOS, so you may want to just run the macOS repair tool to see if it can fix that for you. If you want to run the Homebrew 2.7.14 instead of the Apple 2.7.10, you should do that by specifying it explicitly, or creating a bash alias, or putting its path higher on `PATH` than `/usr/bin`, not by changing what `/usr/bin/python` is. – abarnert Jul 31 '18 at 02:16
  • I reinstalled and it works fine..Thanks. – user1050619 Jul 31 '18 at 18:41
  • When I try to pip install, it is still pointing to python3 version, how can I change it to point to python2. – user1050619 Jul 31 '18 at 19:14
  • @user1050619 See this question -> https://stackoverflow.com/questions/36311336/pip-suddenly-using-wrong-version-of-python – GetHacked Jul 31 '18 at 19:26

0 Answers0