ModuleNotFoundError:尽管在我的Mac OS上安装了panda,但没有名为“ panda”的模块

时间:2018-10-15 12:01:15

标签: python pandas

我在Mac OS上安装了anaconda。但是,当我尝试导入熊猫库时,由于找不到熊猫模块而抛出错误。

因此,当我再次尝试安装熊猫时。上面说熊猫已经安装在机器上了

C27:python-programming jyoti.aditya$ pip install pandas
Requirement already satisfied: pandas in 
/Users/aditya/anaconda3/lib/python3.7/site-packages (0.23.4)
Requirement already satisfied: python-dateutil>=2.5.0 in 
/Users/aditya/anaconda3/lib/python3.7/site-packages (from pandas) 
(2.7.3)
Requirement already satisfied: pytz>=2011k in 
/Users/aditya/anaconda3/lib/python3.7/site-packages (from pandas) 
(2018.5)
 Requirement already satisfied: numpy>=1.9.0 in 
/Users/aditya/anaconda3/lib/python3.7/site-packages (from pandas) 
(1.15.1)
Requirement already satisfied: six>=1.5 in 
/Users/aditya/anaconda3/lib/python3.7/site-packages (from python- 
dateutil>=2.5.0->pandas) (1.11.0)

但是当我尝试在我的python代码中导入Panda库时。抛出错误

C27:python-programming aditya$ python
Python 3.7.0 (default, Jun 28 2018, 07:39:16)
[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> import panda as pd
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'panda'

2 个答案:

答案 0 :(得分:3)

模块名称为pandas,而不是panda。通常,它是这样导入的:

import pandas as pd

有关该库的快速介绍,请参见10 Minutes to pandas页。

答案 1 :(得分:2)

您已经通过pandas安装了pip,但是在尝试导入时却错过了pandas结尾处的s。

import pandas as pd将起作用。