为什么brew安装的python看不到pip安装的模块?
为什么brew安装的python看不到pip安装的模块?,python,pip,homebrew,Python,Pip,Homebrew,pandas和pandasql都是通过pip安装的,并且对系统/macos版本的python可见。它们对安装的brewpython不可见:它们导致 ImportError: No module named pandas 我还尝试了brew特定的pip: $/usr/local/Cellar/python/2.7.14/libexec/bin/pip install pandasql Requirement already satisfied: pandasql in /Library/Py
pandas
和pandasql
都是通过pip
安装的,并且对系统/macos版本的python
可见。它们对安装的brew
python不可见:它们导致
ImportError: No module named pandas
我还尝试了brew
特定的pip:
$/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)
那么为什么pip
/pip2
和brew
版本的python
不一致呢?如何解决这个问题
注意:我也尝试过使用brew
版本的pip
,只是为了确保:它给出了相同的结果
$which pip
/usr/local/Cellar/python/2.7.14/libexec/bin/pip
假设brew至少正确安装了Python,确保使用其pip模块的一个解决方法是像这样显式使用它
python -m pip install
如果需要,您可以使用别名
pip inst
重定向到该位置,这样就不必键入Brew将Python安装到/usr/local
。您的pip
显然是指系统/Library/
Python安装。它们是两种不同的安装。@deceze那么brew
python使用哪种pip
(或类似pip2
)呢?我专门使用了brew的pip
$哪个pip/usr/local/ceral/python/2.7.14/libexec/bin/pip不同,是的。运行您可能只想使用python-m pip install
并依赖python安装本身的程序,而我已经接受并投票支持了这个答案-您是否了解pip
无法正常工作的原因(即使它来自/usr/local/cillar/。
下的brew
安装)?试试brew医生?重启机器?新的终端会话?我真的不确定