How to quickly load third-party modules in PyCharm

In the "Xiaobai Learning Python" MOOC, a variety of methods for loading third-party modules are explained. Here is a more convenient way to set up domestic image source loading in PyCharm.

Because by default, PyCharm loads module resources of foreign websites, so it often fails to load due to unstable network. Therefore, you can set up and load domestic third-party module mirror sites, here are two recommended:

https://mirrors.aliyun.com/pypi/simple/
https://pypi.tuna.tsinghua.edu.cn/simple

They are the mirror websites of Ali and Tsinghua University respectively.

By the way~ Friends who need the original code and want to learn Python can ↓ ↓ ↓

Click here~~ (Note: Su)

There are a lot of resources that can be prostituted for nothing, and I will update the little knowledge of Python from time to time! !

In PyCharm, you can change the default way to load foreign websites by:

1) Open "File" - "Settings", select "Project Interpreter", click the plus sign in the upper right corner, this is no different from loading third-party modules in general. Please add a picture description
2) Click the "Manage Repositories" button in the interface at this time:
Please add a picture description
3) In the interface that appears, select an existing foreign website, click the minus sign in the upper right corner, and delete it: Please add a picture description
4) Continue to click on the upper right Add the plus sign in the corner to add the URL of a new domestic mirror website, and you can even continue to add more URLs:

Please add a picture description
5) Search again at this time, you can find that these searched modules are all on the domestic server, click "Install Package" on the bottom left again, the download and installation will be very fast and stable!
Please add a picture description
6) Some exceptions sometimes occur, mainly due to the need to upgrade the pip program of the Python loading module. The method is to enter in PyCharm's Terminal:

pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
pip install --upgrade pip

The first line is to set the domestic mirror site in Terminal. After running this line once, you don’t need to specify the domestic mirror when you install the module in Terminal in the future, and you can also download it by default.

The second line is to upgrade pip.

Generally speaking, the problem can be solved at this time.

7) If there is still a problem, you can install it directly in Terminal by:

pip install pandas

At this point, you only need to replace pandas with the module you want to install, and there is no need to set up any domestic mirroring. The default is domestic download, which is also convenient and fast!

at last

Friends who need the original code and want to learn Python can ↓ ↓ ↓

Click here~~ (Note: Su)

There are a lot of resources that can be prostituted for nothing, and I will update the little knowledge of Python from time to time! !

Guess you like

Origin blog.csdn.net/weixin_72934044/article/details/128231991