简体   繁体   中英

Why does brew installed python not see the pip installed modules?

Both pandas and pandasql were installed via pip and are visible to the system/macos version of python . They are not visible to the brew installed python : they result in

ImportError: No module named pandas

I have tried the brew specific pip's as well:

 $/usr/local/Cellar/python/2.7.14/libexec/bin/pip install pandasql 
Requirement already satisfied: pandasql in /Library/Python/2.7/site-packages
Requirement already satisfied: numpy in /Users/sboesch/Library/Python/2.7/lib/python/site-packages (from pandasql)
Requirement already satisfied: sqlalchemy in /Library/Python/2.7/site-packages (from pandasql)
Requirement already satisfied: pandas in /Library/Python/2.7/site-packages (from pandasql)
Requirement already satisfied: pytz>=2011k in /Library/Python/2.7/site-packages (from pandas->pandasql)
Requirement already satisfied: python-dateutil in /Users/sboesch/Library/Python/2.7/lib/python/site-packages (from pandas->pandasql)
Requirement already satisfied: six>=1.5 in /Users/sboesch/Library/Python/2.7/lib/python/site-packages (from python-dateutil->pandas->pandasql)

So then why are pip / pip2 and the brew version of python disagreeing? How can this be fixed?

Note: I have also tried using the brew version of pip just to be sure: it gives the same results.

$which pip
/usr/local/Cellar/python/2.7.14/libexec/bin/pip

Assuming brew at least installed Python correctly, a workaround to ensure its pip module is used is to explicitly use it like so

python -m pip install 

If you want, you can alias pip-inst to redirect to that, so it's less typing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM