The fact that the error comes from /anaconda3/bin/pip
means that you're running the pip
command for your Anaconda installation, not the pip
command for the other Python 3.6 installation you actually wanted to use (the one in /Library/Frameworks/Python/Versions/3.6
).
I'm not sure how your Anaconda installation got broken, but if you don't want to use it, it may be easier to just uninstall it than to try to fix it.
And that will also save you a lot of confusion in the future. Having multiple Python installations around can be useful, but if you don't have any useful for it, why give yourself the headaches?1
Meanwhile, because of all of that confusion, when you have, or might have, multiple Python installations, the recommended way to run pip
is not just pip
, but instead python3 -m pip
or python3 -m pip
, or /Library/Frameworks/Python/Versions/3.6/bin/python -m pip
. Basically, whatever command you use to run Python itself, use that same command (with -m pip
added) to run pip
.
You might also want to consider using a virtual environment. Once you've activated an environment, everything will just work, no matter what other Python installations you have lying around.
1. Unfortunately, on macOS, there's a pre-installed Python 2.7 whether you want it or not, so you will have at least two Python versions. But you can usually avoid this by either making sure to use python3
, pip3
, etc. instead of the no-suffix versions, or using virtual environments. Also, if your main Python is a 3.x version, and you've installed it so that it doesn't need sudo
, so you never use sudo
, you can never accidentally install something into the Apple Python instead of the one you wanted—if you do, you'll get permission errors and nothing will get installed anywhere.