" to the opened configuration file; 3. Save the modifications file and exit the editor; 4. In the terminal or command line, enter the "pip install " command to test whether the configuration is successful."/> " to the opened configuration file; 3. Save the modifications file and exit the editor; 4. In the terminal or command line, enter the "pip install " command to test whether the configuration is successful.">

Home  >  Article  >  Backend Development  >  How to configure pip domestic source

How to configure pip domestic source

尊渡假赌尊渡假赌尊渡假赌
尊渡假赌尊渡假赌尊渡假赌Original
2023-12-19 11:06:441803browse

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
  1. Configure pip source: In the opened configuration file, add the following content:
[global]
index-url = https://pypi.tuna.tsinghua.edu.cn/simple

or

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

or

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

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 包名

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!

Statement:
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