Home > Backend Development > Python Tutorial > Find the appropriate pip mirror source to ensure a smooth installation!

Find the appropriate pip mirror source to ensure a smooth installation!

WBOY
Release: 2024-01-16 08:51:08
Original
1078 people have browsed it

Find the appropriate pip mirror source to ensure a smooth installation!

How to choose a suitable pip mirror source?

pip is a Python package management tool that can be used to download, install, upgrade, and uninstall Python packages. But when we use pip to install Python expansion packages, we sometimes encounter problems that cannot be downloaded. The main reason is that the download speed is too slow or the network is restricted. To solve these problems, we can use mirror sources, which can provide faster download speeds and more stable network connections.

The following lists several commonly used Python image sources, their installation methods and test results.

  1. Official source

Using the official source in China will be very slow and may even fail to install successfully, so it is not recommended to use the official source directly.

$ pip install PACKAGE_NAME
Copy after login
  1. Tsinghua Source

Tsinghua Source is one of the long-term stable Python community sources, providing various software package images including pip, conda and npm.

Install Tsinghua source:

$ pip install -i https://pypi.tuna.tsinghua.edu.cn/simple PACKAGE_NAME
Copy after login

Test Tsinghua source:

$ ping pypi.tuna.tsinghua.edu.cn
Copy after login
  1. Alibaba Cloud source

Alibaba Cloud source 1.x and The difference between 2.x is that 1.x uses http and 2.x uses https protocol. Use according to specific network environment.

Install Alibaba Cloud Source:

Alibaba Cloud Source 1.x

$ pip install -i http://mirrors.aliyun.com/pypi/simple/ PACKAGE_NAME --trusted-host mirrors.aliyun.com
Copy after login

Alibaba Cloud Source 2.x

$ pip install -i https://mirrors.aliyun.com/pypi/simple/ PACKAGE_NAME --trusted-host mirrors.aliyun.com
Copy after login

Test Alibaba Cloud Source:

$ ping mirrors.aliyun.com
Copy after login
  1. USTC University of Science and Technology Source

The mirror source of the University not only provides mirror services, but also provides other services, such as scientific Internet access, compiler downloads, etc.

Install the source of the University of Science and Technology of China:

$ pip install -i https://pypi.mirrors.ustc.edu.cn/simple PACKAGE_NAME
Copy after login
Copy after login

Test the source of the University of Science and Technology of China:

$ ping pypi.mirrors.ustc.edu.cn
Copy after login
Copy after login
  1. Douban source

Douban source provides a good Python image The service is also very effective in domestic use.

Install Douban source:

$ pip install -i https://pypi.douban.com/simple PACKAGE_NAME
Copy after login

Test Douban source:

$ ping pypi.douban.com
Copy after login
  1. University of Science and Technology of China source

Install the source of University of Science and Technology of China:

$ pip install -i https://pypi.mirrors.ustc.edu.cn/simple PACKAGE_NAME
Copy after login
Copy after login

Testing the source of University of Science and Technology of China:

$ ping pypi.mirrors.ustc.edu.cn
Copy after login
Copy after login

The above is the selection and installation method of pip mirror source. Through these methods, we can effectively solve the problem of downloading Python related packages caused by network problems. time problem.

The above is the detailed content of Find the appropriate pip mirror source to ensure a smooth installation!. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template