Matplotlib library can be installed using pip command. Identify the correct syntax from the following options.
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.
Related questions:
2025: 3 June Shift 2
2026: 24 May Shift 1
2025: 22 May Shift 1
2026: 13 May Shift 2