You have to install it using pip.
pip install pycountry
And then you can use it :)
Answer from Víctor López on Stack OverflowPyPI
pypi.org › project › pycountry
pycountry · PyPI
pip install pycountry Copy PIP instructions · Latest release · Released: Feb 17, 2026 · ISO country, subdivision, language, currency and script definitions and their translations · These details have been verified by PyPI · changelog · issues · source · Repository ·
Help
The Python Package Index (PyPI) is a repository of software for the Python programming language.
Sponsors
The Python Package Index (PyPI) is a repository of software for the Python programming language.
Register
The Python Package Index (PyPI) is a repository of software for the Python programming language.
Log in
The Python Package Index (PyPI) is a repository of software for the Python programming language.
PyPI
pypi.org › project › pycountry-convert
pycountry-convert · PyPI
Extension of Python package pycountry providing conversion functions. pip install pycountry-convert · Using country data derived from wikipedia, this package provides conversion functions between ISO country names, country-codes, and continent names. map_countries(cn_name_format="default", cn_extras={}): Return a dict of countries with key as country name (standard and official) with ISO 3166-1 values Alpha 2, Alpha 3, and Numeric.
» pip install pycountry-convert
Videos
Top answer 1 of 3
7
You have to install it using pip.
pip install pycountry
And then you can use it :)
2 of 3
0
I had the same problem and looked thru several articles and youtube videos but none got my pycharm fixed to recognize the pycountry module until I tried executing the program in the pycharm IDE terminal and then the pycharm EDE started to recognize it.
Parseltongue
parseltongue.co.in › exploring-countries-with-the-pycountry-module-in-python
ParselTongue - Exploring Countries with the pycountry Module in Python
September 1, 2023 - It is challenging to collect while working on the projects with countries and currencies data. Today we will learn a module with all the data, pycountry. Let us dive into the code. Installation · pip install pycountry · Listing countries · import pycountry countries = pycountry.countries for country in countries: print(country.name) Output ·
Pycountry
pycountry.com
PyCountry – My WordPress Blog
Install Pycountry from PyPI using your preferred Python package manager. The package has no runtime dependencies and supports modern workflows with pip, Poetry, and uv for seamless integration into Python applications.
GitHub
github.com › koldakov › pycountries
GitHub - koldakov/pycountries: Python library to access ISO country and currency standards. · GitHub
There is a great library pycountry, but it is incompatible with enums, for sure enums can be generated dynamically, but python does not work good with dynamic enums, for example, you can not inherit from enums, annotations will be broken, etc. pycountries solves these issues and more. Soon pycountries will be providing other ISO standards related to countries. python3.12 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
Author koldakov
piwheels
piwheels.org › project › pycountry
piwheels - pycountry
pip3 install pycountry · None · PyPI page · pypi.org/ project/ pycountry · Project JSON · piwheels.org/ project/ pycountry/ json · Versions · 64 · Files · 64 · Downloads · (all time) loading... Downloads · (last 30 days) loading... Search issues for this package ·
GitHub
github.com › pycountry › pycountry
GitHub - pycountry/pycountry: A Python library to access ISO country, subdivision, language, currency and script definitions and their translations. · GitHub
A Python library to access ISO country, subdivision, language, currency and script definitions and their translations. - pycountry/pycountry
Starred by 964 users
Forked by 140 users
Languages Python 90.8% | Makefile 8.9% | Nix 0.3%
PyPI
pypi.org › project › pycountry-nopytest
pycountry-nopytest · PyPI
pip install pycountry-nopytest Copy PIP instructions · Latest release · Released: Jul 10, 2013 · ISO country, subdivision, language, currency and script definitions and their translations · These details have been verified by PyPI · sontek · These details have not been verified by PyPI ·
» pip install pycountry-nopytest
Published Jul 10, 2013
Version 0.16.dev0
PyPI
pypi.org › project › pycountries
pycountries · PyPI
There is a great library pycountry, but it is incompatible with enums, for sure enums can be generated dynamically, but python does not work good with dynamic enums, for example, you can not inherit from enums, annotations will be broken, etc. pycountries solves these issues and more. Soon pycountries will be providing other ISO standards related to countries. python3.12 -m venv .venv source .venv/bin/activate pip install -r requirements.txt
» pip install pycountries
Nic's notes
notes.nicolasdeville.com › python › library-pycountry
Python library: pycountry | Nic's notes
March 11, 2023 - pip install pycountry · import pycountry def get_country_code(location): try: country = pycountry.countries.search_fuzzy(location) return country[0].alpha_2 except: return None · Returns a LookupError: cambridge, massachusetts when doing a fuzzy search with "Cambridge, Massachusetts" as input.
Cern
simple-repository.app.cern.ch › project › pycountry
pycountry · Python Simple Repository Browser
pip install pycountry ·   Latest version Released: Feb 17, 2026 · ISO country, subdivision, language, currency and script definitions and their translations · Navigation Description Releases Files Dependencies · Project Links Changelog Issues Source ·
GitHub
github.com › pypa › pipenv › issues › 3245
Unable to install pycountry · Issue #3245 · pypa/pipenv
November 17, 2018 - Running installation with Administrator rights. Verified installations work by installing other packages (django in the above output for example) ... Installing pycountry via pip (pip install pycountry) in pipenv shell works.
Author pypa
Towards AI
towardsai.net › home › publication › latest › top 10 python libraries to work with geo-spatial data in 2022
Top 10 Python libraries to work with geo-spatial data in 2022 | Towards AI
July 26, 2023 - pip install pycountry · Moreover, I mark an available pycountry extension which is pycountry-convert, which provides quick and easy conversion functions between country names and codes, and also continents. pip install pycountry-convert · In case you have not experience with geocoding and you want to try this fantastic package, I leave you here an embed of my example made in JuPyter notebook.