I used brew to install python 2.7
and now my mac have 2 python version
on in /usr/bin/python
and another on in /usr/local/Cellar/python/2.7.12_2/
pip
installed oursql
to /usr/local/lib/python2.7/site-packages
what should i do about it?
I used brew to install python 2.7
and now my mac have 2 python version
on in /usr/bin/python
and another on in /usr/local/Cellar/python/2.7.12_2/
pip
installed oursql
to /usr/local/lib/python2.7/site-packages
what should i do about it?
A good solution can be found here. However, I am gonna explain the nature of the issue and a more quick solution here too:
Problems of this kind, that is when you have installed some package, but Python is not able to find it usuallly is because of one of the following reasons:
Here you are are facing the third type. A quick solution without doing any changes to search path of the system is to simply add the path to the directory that the library is installed at to your Python search path:
import sys, os
sys.path.append(os.path.abspath(<path to the installation directory>))
in your case:
sys.path.append(os.path.abspath('/usr/local/lib/python2.7/site-packages'))
Finally got it work after I symlink with brew's python
It was not symlinked into /usr/local
The command is simply brew link python
and now which python
will point to /usr/local/bin/python