0
0
PythonHow-ToBeginner · 3 min read

How to Install Third Party Module in Python Quickly

To install a third party module in Python, use the pip install module_name command in your terminal or command prompt. This downloads and installs the module so you can import and use it in your Python programs.
📐

Syntax

The basic syntax to install a Python module is:

  • pip install module_name: Installs the module named module_name.
  • You can run this command in your system's terminal or command prompt.
  • Use pip3 instead of pip if you have multiple Python versions and want to specify Python 3.
bash
pip install module_name
💻

Example

This example shows how to install the popular third party module requests which helps you work with web requests easily.

bash
pip install requests
Output
Collecting requests Downloading requests-2.31.0-py3-none-any.whl (62 kB) Installing collected packages: requests Successfully installed requests-2.31.0
⚠️

Common Pitfalls

Some common mistakes when installing modules:

  • Running pip install inside Python shell instead of system terminal.
  • Not having pip installed or it not being in your system PATH.
  • Using the wrong Python version's pip if you have multiple versions installed.
  • Not having internet connection during installation.

Always run pip install in your system terminal, not inside Python interactive mode.

bash
>>> pip install requests
# Wrong: This is inside Python shell and will cause error

# Correct way:
$ pip install requests
📊

Quick Reference

Summary tips for installing Python modules:

  • Use pip install module_name in terminal.
  • Use pip3 if needed for Python 3.
  • Check pip version with pip --version.
  • Upgrade pip with pip install --upgrade pip.
  • Use virtual environments to avoid conflicts.

Key Takeaways

Use pip install module_name in your system terminal to install third party Python modules.
Do not run pip install inside the Python interactive shell; always use the system command line.
Use pip3 if you have multiple Python versions and want to install for Python 3.
Make sure pip is installed and updated to avoid installation errors.
Consider using virtual environments to manage module installations safely.