简体   繁体   English

ModuleNotFoundError:即使已安装,也没有名为“pycountry”的模块

[英]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.我使用pippip3导入了模块,我还尝试使用 python、python3 和 IDLE 在终端中运行我的代码。

Why doesn't python recognize the module ?为什么 python 不能识别module I'm receiving the same error about plotly and pandas as well.我也收到关于plotlypandas的相同错误。

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.

相关问题 “ModuleNotFoundError:即使安装了模块,也没有名为‘...’的模块 - "ModuleNotFoundError: No module named '…' even though module is installed ModuleNotFoundError:没有名为“google.cloud”的模块,即使我安装了它 - ModuleNotFoundError: No module named 'google.cloud' even though I installed it ModuleNotFoundError:即使我安装了功能工具,也没有名为“功能工具”的模块 - ModuleNotFoundError: No module named 'featuretools' even though I have installed featuretools ModuleNotFoundError:即使安装了包,也没有名为“matplotlib”的模块 - ModuleNotFoundError: No module named 'matplotlib' even though the package is installed ModuleNotFoundError:即使已安装,也没有名为“制表”的模块 - ModuleNotFoundError: No module named 'tabulate' even though its installed ModuleNotFoundError:即使 Cython 安装在 Azure Devops 中,也没有名为“Cython”的模块 - ModuleNotFoundError: No module named 'Cython' even though Cython is installed in Azure Devops ModuleNotFoundError:没有名为“googlemaps”的模块 - 尽管安装了 googlemaps - ModuleNotFoundError: No module named 'googlemaps' - though googlemaps installed ModuleNotFoundError,即使模块已成功安装 - ModuleNotFoundError, even though module is successfully installed ModuleNotFoundError:即使安装后也没有名为“selenium”的模块 - ModuleNotFoundError: No module named 'selenium' even after installed Keras给出错误“ ModuleNotFoundError:没有名为'tensorflow'的模块”,即使安装了tensorflow-gpu - Keras giving error “ModuleNotFoundError: No module named 'tensorflow'” even though tensorflow-gpu is installed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM