How does pycharm automatically import third-party libraries?

Time:2022-5-10

Sometimes when we use Python to program in Python, we need to import a large number of third-party libraries. How can we set it to automatically import third-party libraries? We don’t need to use the command line to import manually. We can use shortcut keys to import quickly. Let’s take a look at the detailed setting methods.

Open pycharm on our computer and you can see the input here“import requests”Burst red,Represents that the request third-party library has not been importedAs shown in the figure below:

We slide the mouse toimport requests”When near, press“Alt + enter” keyAs shown in the figure below:

Press“alt+enteAfter the “R” key, select“Install Package requests”Automatically import the third-party library, as shown in the following figure:

You can see that the third-party library has been imported and the program has been successfully run, as shown in the figure below:

We can also enter at the command prompt“pip install requests“Manually import the third-party library, as shown in the following figure:

The above is how pycharm can automatically import third-party libraries. I hope you like it. Please continue to pay attention to developeppaer.

Relevant recommendations:

How does pycharm connect and configure MySQL database?

How does pycharm use numpy? Skills of installing numpy library by pycharm

How does pycharm install third-party libraries? Pychart’s skills in installing Python Library