无法导入名为 pandas 的模块

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/34853828/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 00:31:35  来源:igfitidea点击:

unable to import module named pandas

pythonpandasimportmodule

提问by shad

I have python 2.7 and python 3 installed.

我安装了 python 2.7 和 python 3。

I also have pip2.7 and pip3 installed.

我还安装了 pip2.7 和 pip3。

I use IPython Notebook in the Jupyter console. Using the console I can use every module I want but I'm trying to use the terminal :

我在 Jupyter 控制台中使用 IPython Notebook。使用控制台我可以使用我想要的每个模块,但我正在尝试使用终端:

python script.py arg1 arg2

I have installed pandas 0.17.1 in both versions of python.

我已经在两个版本的 python 中安装了 pandas 0.17.1。

Then I launch my script in the terminal and I get the following error:

然后我在终端中启动我的脚本,我收到以下错误:

Traceback (most recent call last):                                                                                                             
  File "script.py", line 21, in <module>                                                                                                
     import pandas as pd                                                                                                                        
 ImportError: No module named pandas

and yet when running

然而在跑步时

pip install pandas
pip2.7 install pandas

it says:

它说:

 requirement already satisfied

How can I enable pandas to be imported in my script running in Terminal ? Any ideas ?

如何在终端中运行的脚本中导入Pandas?有任何想法吗 ?

Thank you.

谢谢你。

回答by Oren

try first to uninstall pandas

首先尝试卸载Pandas

pip uninstall pandas
pip2.7 uninstall pandas

and then try to reinstall it.

然后尝试重新安装它。

回答by Joshwin Vadakkadam

    pip install numpy
    pip install pandas

pip install django-pandas

pip 安装 django-pandas

django-pandas supports Django (>=1.4.5)

django-pandas 支持 Django (>=1.4.5)

In some cases it is required to install numpy in your virtual

在某些情况下,需要在您的虚拟机中安装 numpy

回答by Prajna Hegde

try the below command(this is for ubuntu 16.04)

尝试以下命令(这是针对 ubuntu 16.04)

sudo apt-get install python-pandas