-->

Welcome to our Coding with python Page!!! hier you find various code with PHP, Python, AI, Cyber, etc ... Electricity, Energy, Nuclear Power

Saturday 22 June 2019

Downgrading Python to version 3.6.5_1 with Homebrew on Mac OS X (brew install python 3.6)

After running brew update; brew upgrade, brew updated python to version 3.7.x.x. When my code stopped working, I noticed that some of the 3rd party packages i use are not compatible Python 3.7.x.x yet. So i decided to revert to Python 3.6.5_1 the version that i am certain i will not have any troubles with.
I failed after trying to to revert to an older version using the usual method: brew install python@3.6.5_1 or: brew install python@3.6.5 or even: brew install python@3.6
After spending some time testing solutions i found the following posts that explained the situation to a great extent:
So, without further due, here is the solution:

First let’s ask brew to remove the links to the most recent python version, that brew installed automatically:
$ brew unlink python
Then let’s install the version 3.6.5_1 by directing brew to the suitable commit of the python brew formula on the Homebrew formulae repository. The commit ID for Python 3.6.5_1 Formula is: f2a764ef944b1080be64bd88dca9a1d80130c558. To avoid the issue with circular dependencies the flag –ignore-dependencies must be used:
$ brew install --ignore-dependencies https://raw.githubusercontent.com/Homebrew/homebrew-core/f2a764ef944b1080be64bd88dca9a1d80130c558/Formula/python.rb

Then let’s ask brew to create the links to the freshly installed version of python:
$ brew switch python 3.6.5_1
And finally and most crucially, to avoid having to do that again after running brew update; brew upgrade. Tell brew that you don’t want to update the python formula in the future:
$ brew pin python
You can allow brew to update python by simply reverting the previous action:
$ brew unpin python

No comments:

Post a Comment

Thanks for your comments

Rank

seo