News from this site

 Rental advertising space, please contact the webmaster if you need cooperation


+focus
focused

classification  

no classification

tag  

no tag

date  

2024-11(7)

Python 使用 pip 安装 matplotlib 模块(精华版)

posted on 2023-06-06 10:31     read(398)     comment(0)     like(21)     collect(2)



1. Use pip to install matplotlib (five-step implementation):


To make a long story short: It took me about three and a half hours to download matplotlib and hit the wall repeatedly, and I almost ran away. In order not to let the new friends take my detour, I specially created this article to point out the direction.

1. First you need to download python

I downloaded it directly from the software store that comes with the computer, which is convenient, and of course there is no problem under the official website.

Need to understand that python comes with pip

2. win + R, enter cmd to enter the console, enter the command: pip --versioncheck whether there is pip, the following is the situation of pip:

insert image description here

If not, enter the command: python -m ensurepip --default-pipdownload one, and you may need to update it after downloading)

3. Update pip (mine is the latest version) and enter the command in cmd:python.exe -m pip install --upgrade pip

(After the update, you can enter the command in cmd: pip --versioncheck the version)

4. Change pip from a foreign source to a domestic source (if you don’t change it, the download speed of matplotlib will be very slow, and the connection will be disconnected, so it keeps reporting errors, which is the key point!) (I am defeated here)

Follow this big brother to change it. It really only takes two or three minutes. The personal test is effective and saved me from the heat of the water: 1 minute to set up the pip mirror source

5. Enter the command in cmd: python -m pip install matplotlibdownload matplotlib library

The download process is similar to this:
insert image description here
just wait patiently for a while, if there is any download failure or the like, 90% of them are because you did not complete step 4.

After downloading, you can enter the command in cmd: python -m pip listsee if there is this matplotlib in it
insert image description here

If there is, it means success.


2. Use the downloaded matplotlib to download pycharm and draw:


As for wanting to use the drawing module in pycharm, the following brief pictures have been taken:

Open Settings
insert image description here

Open python interperter and click + insert image description here3 on the right.

Search for the newly downloaded matpotlib library
insert image description here
and click Install package in the lower left corner to download. After downloading, just find a drawing code copy on the Internet and try it out:

insert image description here



Category of website: technical article > Blog

Author:kkkkkkkkkkdsdsd

link:http://www.pythonblackhole.com/blog/article/79680/46648c5d3d0088a64c26/

source:python black hole net

Please indicate the source for any form of reprinting. If any infringement is discovered, it will be held legally responsible.

21 0
collect article
collected

Comment content: (supports up to 255 characters)