Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/312.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
为什么brew安装的python看不到pip安装的模块?_Python_Pip_Homebrew - Fatal编程技术网

为什么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医生?重启机器?新的终端会话?我真的不确定