[英]ModuleNotFoundError: No module named 'pycountry' even though it is installed
I got this error from python ModuleNotFoundError: No module named 'pycountry'
.我从 python ModuleNotFoundError: No module named 'pycountry'
收到此错误。
I imported the module using pip
and pip3
and I've also tried running my code in terminal using python, python3, and IDLE.我使用pip
和pip3
导入了模块,我还尝试使用 python、python3 和 IDLE 在终端中运行我的代码。
Why doesn't python recognize the module
?为什么 python 不能识别module
? I'm receiving the same error about plotly
and pandas
as well.我也收到关于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 = {}
Open your command window and then use this code there.打开您的命令 window 然后在此处使用此代码。
pip install pycountry pip 安装pycountry
This will install the whole package in your system, so whenever you import the module, it will not show an error.这将在您的系统中安装整个 package,因此无论何时导入模块,它都不会显示错误。
This worked for me, I was facing the same issue while using it in Jupyter Notebook.这对我有用,我在 Jupyter Notebook 中使用它时遇到了同样的问题。 If you want more information please visit this page .如果您想了解更多信息,请访问此页面。
If you have Anaconda, try:如果您有 Anaconda,请尝试:
conda install -c conda-forge pycountry
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.