Home Backend Development Python Tutorial Quick settings, one-click configuration of pip mirror sources!

Quick settings, one-click configuration of pip mirror sources!

Jan 16, 2024 am 10:49 AM
pip Configuration Mirror source

Quick settings, one-click configuration of pip mirror sources!

Simple operation, easily configure pip mirror source directory!

Introduction:
In the process of using Python to develop, we often need to use pip to install and manage third-party libraries. However, due to network reasons, downloading using the default official mirror source may be slow or even fail. Therefore, many developers will choose to use domestic mirror sources to speed up downloads. This article will introduce how to configure the pip mirror source and provide some commonly used domestic mirror sources for everyone to choose from.

1. How to configure the pip mirror source:

  1. Temporary use:
    When using the pip command, you can specify the mirror source to be used by adding the -m parameter. For example, to use Alibaba Cloud's mirror source:
pip install -m https://mirrors.aliyun.com/pypi/simple 包名
Copy after login
  1. Permanent use:
    If you want to use a mirror source permanently, you can do so by modifying the pip configuration file. Find the folder named pip in the user directory (if there is no such folder, you need to create it manually), create a file named pip.ini under the folder, and then Add the following content to the file:
[global]
index-url = 镜像源地址
Copy after login

Taking the mirror source of Tsinghua University as an example, the configuration file content is as follows:

[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
Copy after login

2. Commonly used domestic mirror sources:

  1. Alibaba Cloud mirror source: https://mirrors.aliyun.com/pypi/simple

Alibaba Cloud provides a stable and reliable mirror source with fast download speed and is recommended.

  1. Tencent Cloud mirror source: https://mirrors.cloud.tencent.com/pypi/simple

Tencent Cloud mirror source is also a good choice, download It's also very fast.

  1. Tsinghua University mirror source: https://pypi.tuna.tsinghua.edu.cn/simple

The mirror source of Tsinghua University is a well-known open source mirror site in China , the download speed is also very fast.

  1. Huawei Cloud mirror source: https://mirrors.huaweicloud.com/repository/pypi/simple

The mirror source provided by Huawei Cloud is also an optional mirror. source, the download speed is faster.

3. Sample code:
The following is a sample code for pip installation using Alibaba Cloud mirror source:

pip install -m https://mirrors.aliyun.com/pypi/simple requests
Copy after login

After configuring the mirror source, when using pip to install a third-party library, You can use the pip command directly without adding the -m parameter:

pip install requests
Copy after login

4. Summary:
Configuring the pip mirror source can improve the installation speed of third-party libraries and make the development process more efficient. This article introduces how to configure pip image sources, and provides some commonly used domestic image sources for everyone to choose from. Hope this article is helpful to everyone!

The above is the detailed content of Quick settings, one-click configuration of pip mirror sources!. For more information, please follow other related articles on the PHP Chinese website!

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

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

The working principle and configuration method of GDM in Linux system The working principle and configuration method of GDM in Linux system Mar 01, 2024 pm 06:36 PM

Title: The working principle and configuration method of GDM in Linux systems In Linux operating systems, GDM (GNOMEDisplayManager) is a common display manager used to control graphical user interface (GUI) login and user session management. This article will introduce the working principle and configuration method of GDM, as well as provide specific code examples. 1. Working principle of GDM GDM is the display manager in the GNOME desktop environment. It is responsible for starting the X server and providing the login interface. The user enters

CentOS7 various version image download addresses and version descriptions (including Everything version) CentOS7 various version image download addresses and version descriptions (including Everything version) Feb 29, 2024 am 09:20 AM

When loading CentOS-7.0-1406, there are many optional versions. For ordinary users, they don’t know which one to choose. Here is a brief introduction: (1) CentOS-xxxx-LiveCD.ios and CentOS-xxxx- What is the difference between bin-DVD.iso? The former only has 700M, and the latter has 3.8G. The difference is not only in size, but the more essential difference is that CentOS-xxxx-LiveCD.ios can only be loaded into the memory and run, and cannot be installed. Only CentOS-xxx-bin-DVD1.iso can be installed on the hard disk. (2) CentOS-xxx-bin-DVD1.iso, Ce

Understand Linux Bashrc: functions, configuration and usage Understand Linux Bashrc: functions, configuration and usage Mar 20, 2024 pm 03:30 PM

Understanding Linux Bashrc: Function, Configuration and Usage In Linux systems, Bashrc (BourneAgainShellruncommands) is a very important configuration file, which contains various commands and settings that are automatically run when the system starts. The Bashrc file is usually located in the user's home directory and is a hidden file. Its function is to customize the Bashshell environment for the user. 1. Bashrc function setting environment

How to configure workgroup in win11 system How to configure workgroup in win11 system Feb 22, 2024 pm 09:50 PM

How to configure a workgroup in Win11 A workgroup is a way to connect multiple computers in a local area network, which allows files, printers, and other resources to be shared between computers. In Win11 system, configuring a workgroup is very simple, just follow the steps below. Step 1: Open the "Settings" application. First, click the "Start" button of the Win11 system, and then select the "Settings" application in the pop-up menu. You can also use the shortcut "Win+I" to open "Settings". Step 2: Select "System" In the Settings app, you will see multiple options. Please click the "System" option to enter the system settings page. Step 3: Select "About" In the "System" settings page, you will see multiple sub-options. Please click

How to configure and install FTPS in Linux system How to configure and install FTPS in Linux system Mar 20, 2024 pm 02:03 PM

Title: How to configure and install FTPS in Linux system, specific code examples are required. In Linux system, FTPS is a secure file transfer protocol. Compared with FTP, FTPS encrypts the transmitted data through TLS/SSL protocol, which improves Security of data transmission. In this article, we will introduce how to configure and install FTPS in a Linux system and provide specific code examples. Step 1: Install vsftpd Open the terminal and enter the following command to install vsftpd: sudo

Use Centos to build an open source mirror site Use Centos to build an open source mirror site Feb 29, 2024 pm 02:30 PM

Building a mirror site requires three steps: find a faster domestic source, install and configure tomcat, and synchronize target source data. Domestic sources are also synchronized with foreign official servers. We need to find domestic sources that support rsync. We can search the keyword [centos mirror station] on Baidu or use my recommendation Tsinghua University open source software mirror station https://mirrors4.tuna .tsinghua.edu.cn/centos/. tomcat installation and configuration installation wgethttp://mirrors.hust.edu.cn/apache/tomcat/tomcat-8/v8.5.24/bin/apache-to

An error occurred when processing pip: DistlibException(\'not found: %s\' % filename) An error occurred when processing pip: DistlibException(\'not found: %s\' % filename) Mar 01, 2024 pm 01:00 PM

The reason for the error is DistlibException('notfound:%s'%filename), which is an error caused by pip when trying to install or uninstall a package, indicating that the specified file cannot be found. This is usually due to network issues or repository issues. It could also be due to the python version or pip version you are using being incompatible with the requested package. How to solve this problem There may be several ways to solve this problem: Check whether your network connection is normal. Try reconnecting and retrying to install the package. Check if your pip and Python versions are compatible with the requested package. Try using the latest version of pip and Python and try installing the package again. Try changing the repository. By using "-i" on the command line or

MyBatis Generator configuration parameter interpretation and best practices MyBatis Generator configuration parameter interpretation and best practices Feb 23, 2024 am 09:51 AM

MyBatisGenerator is a code generation tool officially provided by MyBatis, which can help developers quickly generate JavaBeans, Mapper interfaces and XML mapping files that conform to the database table structure. In the process of using MyBatisGenerator for code generation, the setting of configuration parameters is crucial. This article will start from the perspective of configuration parameters and deeply explore the functions of MyBatisGenerator.

See all articles