Home > Backend Development > Python Tutorial > How to configure pip domestic source

How to configure pip domestic source

尊渡假赌尊渡假赌尊渡假赌
Release: 2023-12-19 11:06:44
Original
1862 people have browsed it

The configuration steps of pip domestic source are as follows: 1. Enter the "pip config edit" command to open the pip configuration file; 2. Add "index-url = "; 3. Save the modified file and exit the editor; 4. In the terminal or command line, enter the "pip install " command to test whether the configuration is successful.

How to configure pip domestic source

# Operating system for this tutorial: Windows 10 system, Dell G3 computer.

In China, using the default pip source to download Python packages may be subject to network restrictions, resulting in slow download speeds or inability to connect. In order to solve this problem, you can configure the domestic pip source to speed up the download.

The following are some commonly used domestic pip sources:

  • Tsinghua University’s pip source: https://pypi.tuna.tsinghua.edu.cn/simple
  • Alibaba Cloud’s pip source: http://mirrors.aliyun.com/pypi/simple/
  • Douban’s pip source: http://pypi.douban.com/simple/

The following are the steps to configure the pip source:

  1. Open the pip configuration file: In the terminal or command line, enter the following command to open the pip configuration file:
pip config edit
Copy after login
  1. Configure pip source: In the opened configuration file, add the following content:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple
Copy after login

or

[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
Copy after login

or

[global]
index-url = http://pypi.douban.com/simple/
Copy after login

according to your Configure the selected source.

  1. Save and close file: Save the modified file and exit the editor.

  2. Test whether it is successful: In the terminal or command line, enter the following command to test whether the pip source is successfully configured:

pip install 包名
Copy after login

Among them, "Package name" is the name of the Python package you want to install. If the download speed is fast and the package is successfully installed, the pip source has been successfully configured.

The above is the detailed content of How to configure pip domestic source. 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