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

杀马特。学长 韩版系。学妹 提交于 2019-12-11 17:33:26

问题


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

回答1:


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



来源:https://stackoverflow.com/questions/47056147/why-does-brew-installed-python-not-see-the-pip-installed-modules

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!