简体   繁体   English

为什么brew安装的python无法看到pip安装的模块?

[英]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 . pandaspandasql都是通过pip安装的,并且对python的system / macos版本可见。 They are not visible to the brew installed python : they result in 它们对于brew安装的python不可见:它们导致

ImportError: No module named pandas

I have tried the brew specific pip's as well: 我也尝试了brew特定的点:

 $/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? 那么,为什么pip / pip2brewpython版本不同呢? 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. 注意:我也尝试过使用pipbrew版本来确保:它给出相同的结果。

$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 假设brew至少正确安装了Python,确保使用其pip模块的解决方法是像这样显式使用它

python -m pip install 

If you want, you can alias pip-inst to redirect to that, so it's less typing 如果需要,您可以为pip-inst别名以重定向到该名称,从而减少了键入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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