How to solve import error for pandas?

后端 未结 11 1692
忘掉有多难
忘掉有多难 2020-11-29 08:03

I installed Anaconda with python 2.7.7.
However, whenever I run \"import pandas\" I get the error:
\"ImportError: C extension: y not built. If you want to impo

相关标签:
11条回答
  • 2020-11-29 08:36

    Pandas has portions of its code written in C to make it run faster. If you tried to install pandas manually you would need to build it. Try reinstalling it with miniconda package manager here: http://conda.pydata.org/miniconda.html

    and then you can just do

    conda install pandas
    

    There are very simple instructions on how to do it in the link below. Just do ctrl-f miniconda to find the section that talks about it

    http://pandas.pydata.org/pandas-docs/dev/install.html

    0 讨论(0)
  • 2020-11-29 08:40

    I was unable to upgrade pandas with regular

    pip install --upgrade pandas 
    
    "tensorflow 1.6.0 has requirement numpy>=1.13.3, but you'll have numpy 1.13.1 which is incompatible."
    

    However bumping it with:

    pip install --upgrade pandas --force
    

    solved issue completely

    0 讨论(0)
  • 2020-11-29 08:42

    try

    /miniconda3/bin/conda install python
    
    python: 3.6.0-0 --> 3.6.1-2
    

    and

    /miniconda3/bin/conda install pandas
    

    Try the same with your Anaconda version.

    0 讨论(0)
  • 2020-11-29 08:42

    I had this issue when I needed up upgrade from Python 32 bit to 64 bit to use tensorflow.

    Running this command uninstalled pandas 0.21 and reinstalled 0.22 :

    pip install --upgrade pandas

    Sorted.

    0 讨论(0)
  • 2020-11-29 08:48

    I had the same problem and the issue came from an encoding problem. My os was previously set up in French and everything was fine. But then when I switched to English I had the error above.

    You can type

    locale
    

    in the terminal to check the local environment variables.

    When set up in French, I had this configuration: French config. Then, after I switched to English, I had: English config.

    I then added the following lines in the .bash_profile under /Users/myName and everything went back to normal.

    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
    
    0 讨论(0)
  • 2020-11-29 08:48

    I just had exactly the same issue when running tox.

    Steps to solve:

    1. Update setup.py to contain pandas==0.23.0 (instead of 0.21.0).
    2. Remove .tox directory
    3. Run tox again.
    0 讨论(0)
提交回复
热议问题