Basically you have things in /usr/local that are not done via homebrew and confuses it. So you have to choose to keep the homebrew stuff or the others.
If you do not know which is which I would backup /usr/local amd delete it and start with all homebrew or all others.