ModuleNotFoundError: 找不到模块名为 ‘pandas’ 的模块(ubuntu)

huangapple go评论66阅读模式
英文:

ModuleNotFoundError: No module named 'pandas' (ubuntu)

问题

Am a new user on ubuntu version 20.04.

The fresh install comes with python 3.8, so i upgrade to latest 3.11.

I do the usual pip install pandas.
Note i also try pip3 install pandas for good measure.

create a test file (called test_pandas.py) which contains this:

import pandas as pd

d = {'a':[1,2,3], 'b':[4,6,8]}
df = pd.DataFrame(d)
print(df)

run file with:

python test_pandas.py

get this error message:

ModuleNotFoundError: No module named 'pandas'

so i run file with this (the for 3.8 version python):

python3 test_pandas.py

and get this:

AttributeError: module 'pandas' has no attribute 'Dataframe'

I have looked in several places (finally this: https://pip.pypa.io/en/stable/installation/), but all fail.

totally lost as what to do.
just want 3.11 (latest version) with a corresponding working pip.

how can i achieve this?

英文:

Am a new user on ubuntu version 20.04.

The fresh install comes with python 3.8, so i upgrade to latest 3.11.

I do the usual pip install pandas.
Note i also try pip3 install pandas for good measure.

create a test file (called test_pandas.py) which contains this:

import pandas as pd

d = {'a':[1,2,3], 'b':[4,6,8]}
df = pd.Dataframe(d)
print(df)

run file with:

python test_pandas.py

get this error message:

ModuleNotFoundError: No module named 'pandas'

so i run file with this (the for 3.8 version python):

python3 test_pandas.py

and get this:

AttributeError: module 'pandas' has no attribute 'Dataframe'

I have looked in several places (finally this: https://pip.pypa.io/en/stable/installation/), but all fail.

totally lost as what to do.
just want 3.11 (latest version) with a corresponding working pip.

how can i achieve this ?

答案1

得分: 1

你有一个拼写错误:应该是 DataFrame

英文:

You have a typo: it's DataFrame.

答案2

得分: 0

在一些查找后,我注意到其他Stack帖子建议您安装wheel,然后再安装pandas。您可以尝试这样做。

英文:

After some looking around, I noticed other Stack posts are suggesting you install wheel and then pandas. You could try that.

huangapple
  • 本文由 发表于 2023年2月9日 02:17:06
  • 转载请务必保留本文链接:https://go.coder-hub.com/75390098.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定