How to fix Python Numpy/Pandas installation?

前端 未结 9 603
说谎
说谎 2020-12-24 06:13

I would like to install Python Pandas library (0.8.1) on Mac OS X 10.6.8. This library needs Numpy>=1.6.

I tried this

$ sudo easy_install pandas
Sear         


        
9条回答
  •  旧时难觅i
    2020-12-24 06:44

    I had this exact problem.

    The issue is that there is an old version of numpy in the default mac install, and that pip install pandas sees that one first and fails -- not going on to see that there is a newer version that pip herself has installed.

    If you're on a default mac install, and you've done pip install numpy --upgrade to be sure you're up to date, but pip install pandas still fails due to an old numpy, try the following:

    $ cd /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/
    $ sudo rm -r numpy
    $ pip install pandas
    

    This should now install / build pandas.

    To check it out what we've done, do the following: start python, and import numpy and import pandas. With any luck, numpy.__version__ will be 1.6.2 (or greater), and pandas.__version__ will be 0.9.1 (or greater).

    If you'd like to see where pip has put (found!) them, just print(numpy) and print(pandas).

提交回复
热议问题