0

I install python 3.6.5_1 using

brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.r

and get

Warning: python 3.6.5_1 is already installed

The currently linked version is 3.7.3

You can use brew switch python 3.6.5_1 to link this version.

I use brew switch python 3.6.5_1 and get

Cleaning /usr/local/Cellar/python/3.6.5_1

Cleaning /usr/local/Cellar/python/3.7.3

4 links created for /usr/local/Cellar/python/3.6.5_1

Typing which python3, there is no output, which python gives

/usr/local/bin/python

and typing python3 gives

-bash: /usr/local/bin/python3: No such file or directory typing python gives

Python 2.7.15 (default, Nov 27 2018, 21:24:58) [GCC 4.2.1 Compatible Apple LLVM 10.0.0 (clang-1000.11.45.5)] on darwin Type "help", "copyright", "credits" or "license" for more information.

How do I make sure that the installed python3.6.5_1 is installed at correct location and is the one referred to by python3?

Extra background :

I have been working with OpenCV for around 5 months now, following this installation guide for installing all requirements including python3.6. I was using this version of brew's python instead of mac's one. Recently I had to install FFmpeg, some errors came up, unwittingly I did something (I don't remember, probably unlinked python) and then I wasn't able to install FFmpeg anyway but also this destroyed my workspace. Right now I keep getting the following error everytime I open up terminal:

-bash: /usr/local/bin/python3: No such file or directory virtualenvwrapper.sh: There was a problem running the initialization hooks.

If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3 and that PATH is set properly.

I tried brew install python3 and that solves the above warning for virtualenvwrapper. But it installs python3.7.3, whereas I need python3.6 for tensor flow etc.

momo
  • 1,052
  • 5
  • 16
  • 34
  • Take a look at https://docs.brew.sh/Homebrew-and-Python. Is it possible that Python 3 is the default and just referenced as python? Can you type the banner from when you run `python`? Is it possible that you have a path issue and the system Python is being invoked? – aquil.abdullah Apr 18 '19 at 10:42
  • What it shows when you pass `python` in the terminal? Please add that to your post to get a better understanding. – Saad Apr 18 '19 at 10:45
  • @aquil.abdullah Kindly check my edit, the problem is definitely that python3.6 is not getting installed at the correct location. May be I should do a clean uninstall of everything? – momo Apr 18 '19 at 10:54
  • Try installing python from python.org. I'm a Mac user too and so far I haven't faced any problems by installing python like this. Hope it helps. Link:- https://www.python.org/downloads/mac-osx/ – Saad Apr 18 '19 at 10:58
  • Try Using Conda for all the installations for python. Get it here: https://www.anaconda.com/ – Raman Saini Apr 18 '19 at 11:31
  • Personally, I'd stick with Homebrew. Try this https://stackoverflow.com/questions/51125013/how-can-i-install-a-previous-version-of-python-3-in-macos-using-homebrew. This should allow you to install python 3.6.5. – aquil.abdullah Apr 18 '19 at 13:04
  • @aquil.abdullah I deleted everything from usr/local and did fresh install as in above link(which I was doing anyway, but didn't work) and I think the problem is solved. Let's see till I try to install FFmpeg again. – momo Apr 18 '19 at 17:32
  • Make sure to look at the requirements for FFmpeg before you install it, and make sure that if there is anything to build that it is referencing your Python 3.6.5 installation. – aquil.abdullah Apr 18 '19 at 19:52

0 Answers0