我在Mac OSX计算机上安装Python Pandas库时遇到问题.
我在终端输入以下内容:
$ sudo easy_install pandas
Run Code Online (Sandbox Code Playgroud)
但后来我得到以下内容:
Searching for pandas
Reading http://pypi.python.org/simple/pandas/
Reading http://pandas.pydata.org
Reading http://pandas.sourceforge.net
Best match: pandas 0.9.0
Downloading http://pypi.python.org/packages/source/p/pandas/pandas-
0.9.0.zip#md5=04b1d8e11cc0fc30ae777499d89003ec
Processing pandas-0.9.0.zip
Writing /tmp/easy_install-ixjbQO/pandas-0.9.0/setup.cfg
Running pandas-0.9.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ixjbQO/pandas-
0.9.0/egg-dist-tmp-EGREoT
warning: no files found matching 'setupegg.py'
no previously-included directories found matching 'doc/build'
warning: no previously-included files matching '*.so' found anywhere in distribution
warning: no previously-included files matching '*.pyd' found anywhere in distribution
warning: no previously-included files matching '*.pyc' found anywhere in distribution
warning: no previously-included files matching '.git*' found anywhere in distribution
warning: no previously-included files matching '.DS_Store' found anywhere in distribution
warning: no previously-included files matching '*.png' found anywhere in distribution
unable to execute gcc: No such file or directory
error: Setup script exited with error: command 'gcc' failed with exit status 1
Run Code Online (Sandbox Code Playgroud)
我确实安装了Xcode和gcc,但只有当我键入时才会找到gcc:
$ gcc
-bash: gcc: command not found
$ gcc-4.2
i686-apple-darwin11-gcc-4.2.1: no input files
Run Code Online (Sandbox Code Playgroud)
我该怎么办?
小智 34
安装pip.
然后安装pandas有pip:
pip install pandas
Run Code Online (Sandbox Code Playgroud)
小智 16
你可以用自制软件安装python:
brew install python
Run Code Online (Sandbox Code Playgroud)
确保OSX使用正确的路径:
which python
Run Code Online (Sandbox Code Playgroud)
然后你可以使用pip工具来安装pandas:
pip install pandas
Run Code Online (Sandbox Code Playgroud)
确保已安装所有依赖项.我遵循了这个教程:http://penandpants.com/2013/04/04/install-scientific-python-on-mac-os-x/
在我的机器上正常工作.
尝试
pip3 install pandas
Run Code Online (Sandbox Code Playgroud)
从终端。也许你原来的 pip install pandas 引用了 anaconda 发行版
我建议使用 macport 或 fink 来安装 pandas:
在 macports 中安装 pandas 非常简单: sudo port install py27-pandas
你通常在 /opt/local 中安装 macport,在 /sw 中安装 fink,我建议(尽管这可能是个坏建议)你将你的 fink/mac ports python 符号链接到你的系统 python,如下所示: /usr/bin/python -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7