Jupyter python3 notebook cannot recognize pandas

后端 未结 14 957
终归单人心
终归单人心 2020-12-14 15:56

I am using the Jupyter notebook with Python 3 selected. On the first line of a cell I am entering:

import pandas as pd

The error I get from

相关标签:
14条回答
  • 2020-12-14 16:29

    If you use anaconda already as a distribution, stop using pip in that context. Use conda instead and you will stop having headaches. The command lines and procedures for setting up a new environment are pretty well documented here.

    Basically upgrading python or having specific branches:

    conda update python
    conda install python=3.5
    

    Or using specific environments:

    conda create -n py35 python=3.5 anaconda
    
    0 讨论(0)
  • Iuse window 7 for work and I had the same problems when I tried to import Pandas. So I tried to install packages under each environment:

    Run cmd and type the following code:

    activate py27 
    conda install pandas 
    

    If the system asks you do you want to install the following new packages, choose Y for [yes]

    And install pandas for each different environment if you installed Python27, Python 35 and Python 36, as I did.

    Then problem solved if you run jupyter notebook again and you can import pandas successfully.

    You can also solve the same problem for packages like numpy, scipy, etc..

    0 讨论(0)
  • 2020-12-14 16:30

    I meet the same problem in jupyter notebook, and I run the command below and solve my problem:

    !pip install pandas
    
    0 讨论(0)
  • 2020-12-14 16:30

    I was getting the error

    modulenotfounderror: no module named 'pandas'

    in jupyter. I tried the command:

    !pip install pandas
    

    and it worked like a charm.

    0 讨论(0)
  • 2020-12-14 16:37

    If pip3 is install you could run

    !pip3 install pandas
    
    0 讨论(0)
  • 2020-12-14 16:38

    One silly mistake that you could make is to invoke Jupyter with your local machine python installation and not the anaconda python. I had the same problem and just setting the PATH did not work for me.

    FIX: By default, anaconda binaries are in "<Path_to_anaconda>/bin". For example, in my case, they are in "/home/klakhotia/anaconda3/bin". This directory will also contain the binary to anaconda jupyter. Launch the jupyter from here or create an alias in your .bashrc that points to this file.

    0 讨论(0)
提交回复
热议问题