【发布时间】:2020-11-18 04:24:16
【问题描述】:
我从 python ModuleNotFoundError: No module named 'pycountry' 收到此错误。
我使用 pip 和 pip3 导入了模块,我还尝试使用 python、python3 和 IDLE 在终端中运行我的代码。
为什么 python 不能识别module?我也收到关于 plotly 和 pandas 的相同错误。
import pycountry
import plotly.express as px
import pandas as pd
URL_DATASET = r'https://raw.githubusercontent.com/datasets/covid-19/master/data/countries-aggregated.csv
'
df1 = pd.read_csv(URL_DATASET)
list_countries = df1['Country'].unique().tolist()
d_country_code = {}
【问题讨论】:
-
你用的是哪个python版本?
-
你的脚本名称是什么?您是否安装了依赖项?你正在使用哪个版本的python?
-
您运行的环境可能没有安装这些依赖项。请检查您是否在正确的环境中运行
-
"pip list" 或 "pip3 list" 看看安装了什么 - 或者你可以做 "python[3] -m pip list"里面有pycountry吗?
-
我尝试过使用终端和 IDLE。如何安装任何缺少的依赖项?
标签: python pandas plotly modulenotfounderror