Uninitialized constant OS::Mac::CLT on Linux

I was trying to install Python 3.6 with Brew on Linux however, I get this error when trying to install.

Error: An exception occurred within a child process: NameError: uninitialized constant OS::Mac::CLT

I do not know why this is happening as most online documentation has said that this issue had been patched before.

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

Please let me know what I can do to resolve this issue.

Brew doctor said that my system is ready for brewing and brew–config shows that I am using the latest version of homebrew. Please let me know. All help is greatly appreciated.

Homebrew ships python 3.7. Are you explicitly trying to install an older version?

Yes, I was trying to install Python 3.6 because of its compatibility with Tensorflow, OpenCV and some older libraries. Is installing Python 3.6 using Linuxbrew even possible?

I think most of those libraries are available in linuxbrew with python. https://formulae.brew.sh/formula-linux/libtensorflow and https://formulae.brew.sh/formula-linux/opencv

Short answer is no. Longer answer is yes, but it’s not recommended.
See https://bintray.com/linuxbrew/bottles/python/3.6.5_1#files

brew install https://bintray.com/linuxbrew/bottles/download_file?file_path=python-3.6.5_1.x86_64_linux.bottle.tar.gz

Installing older bottles is not supported.

I get the same error Error: undefined method 'installed?' for OS::Mac::CLT:Module as you got above though, so it’s not possible without patching the Homebrew. Your best bet is
brew install libtensorflow opencv

Thank you so much! What you said had worked!