Matplotlib is a very excellent Python 2D drawing library. As long as the data conforms to the format, Matplotlib can easily create various high-quality data charts such as line charts, bar charts, and scatter charts.
Installing the Matplotlib package is no different from installing other Python packages. You can also use pip to install it.
Start the command line window and enter the following command in the command line window: (Recommended learning: Python video tutorial)
pip install matplotlib
The above command will The latest version of the Matplotlib package will be automatically installed. Run the above command, you can see that the program first downloads the Matplotlib package, and then prompts that the Matplotlib package is installed successfully:
Installing collected packages: matplotlib Successfully installed matplotlib-2.2.3
If the command line window prompts that the pip command cannot be found, you can also pass The python command runs the pip module to install the Matplotlib package.
For example, use the following command to install the Matplotlib package:
python -m pip install matplotlib
After successfully installing the Matplotlib package, you can view the documentation of the Matplotlib package through pydoc. Enter the following command in the command line window:
python -m pydoc -p 8899
After running the above command, open the browser to view the http://localhost:8899/ page, which can be found under lib\site-packages in the Python installation directory See the documentation for the Matplotlib package as shown.
For more Python related technical articles, please visit the Python Tutorial column to learn!
The above is the detailed content of How to install matplotlib in python. For more information, please follow other related articles on the PHP Chinese website!