askvity

How to install pyinputplus?

Published in Python Installation 1 min read

To install pyinputplus, use pip, the Python package installer. Here's how:

  1. Open your terminal or command prompt.

  2. Use pip to install pyinputplus:

    pip install pyinputplus

    This command downloads and installs pyinputplus and its dependencies automatically.

  3. (macOS and Linux Specific - Python 3): If you are using Python 3 on macOS or Linux, you might need to use pip3 instead of pip:

    pip3 install pyinputplus
  4. (Permissions Error): If you encounter permission errors during installation, try installing with the --user option:

    pip install --user pyinputplus

    This installs the package in your user directory, avoiding the need for administrator privileges.

Verification:

After installation, you can verify that pyinputplus is installed correctly by opening a Python interpreter and importing it:

import pyinputplus as pyip

# Example usage (optional)
user_input = pyip.inputInt("Enter an integer: ")
print(f"You entered: {user_input}")

If the import statement doesn't raise an ImportError, pyinputplus is installed successfully.

Related Articles