Skip to main contentSkip to solution

Matplotlib library can be installed using pip command. Identify the correct syntax from the following options.

Solution

✅ Correct Option: 4

pip installs a package by its PyPI name, and the package is called matplotlib, so the command is pip install matplotlib.


Options 1 and 2: no packages with these names exist. pyplot is a module inside matplotlib, not a separate package.

Option 3: as plt is an alias used in a Python import statement, not in a pip command.

The alias is set in code, not at install time: import matplotlib.pyplot as plt.

Keyboard Shortcuts

  • Left arrow: Previous question
  • Right arrow: Next question
  • S key: Jump to solution
  • Q key: Jump to question