Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to add toolkits to Python

2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the knowledge of "how to increase the toolkit for Python". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

One of the important advantages of the Python language is that you can find a large number of toolkits and their sample code. However, most articles generally do not explain how these toolkits are installed when introducing the sample code. This article is to solve this problem.

Here's what happens when you use PyCharm to learn Matplotlib. Enter the following code in PyCharm:

Import matplotlib.pyplot as pltfig = plt.figure () ax = fig.add_subplot (111) ax.set (xlim= [0,5], ylim= [0,10], title='MatPlotLib Demo', ylabel='Y', xlabel='X') plt.show ()

If no preparation is made, the following prompt appears on the execution screen of the program:

Import matplotlib.pyplot as pltModuleNotFoundError: No module named 'matplotlib'

This actually tells us that the matpplotlib module has not been imported (installed). Let's explain step by step how to import additional feature packs in PyCharm.

Open the [File]-[Settings...] menu item:

Select the [Project]-[Project Interpreter] category and press the [+] button (inside the red circle below):

Select the function library you want to install in the list on the right, and press the [Install Package] button. At this point, you can enter the name of the function library in the text box above to narrow the representation of the function library.

The screen indicates that the installation is in progress.

If the user's computer is behind the proxy server, you also need to follow these steps to set up authentication information.

Select [Appearance&Behavior]-[System Settings]-[HTTP Proxy]

According to the actual situation, choose whether to need an agent, manually or automatically set the agent, enter the user name and password, and so on.

Once these settings are complete, the program can be executed:

For command line mode, you can install it using the following command:

Pip install matplotlib

If the user's computer is behind the proxy server, you also need to set the authentication information as follows:

# for linux / unixexport http_proxy= "user:password@server:port" export https_proxy= "user:password@server:port" # windowsset HTTP_PROXY= "user:password@server:port" set HTTPS_PROXY= "user:password@server:port"

User, password, server, and port in the example all need to be replaced with actual authentication information.

This is the end of the content of "how to add the toolkit to Python". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report