How to modify the pip source: 1. Find the pip configuration file. In Windows systems, the file is usually located in C:\Users\your username\AppData\Roaming\pip\pip.ini. On Mac Or in a Linux system, the file is usually located at ~/.pip/pip.conf; 2. Open the pip configuration file, and add or modify the following content to specify the source you want to use; 3. Save the configuration file and close it. .
The operating system for this tutorial: Windows 10 system, Python version 3.11.4, Dell G3 computer.
To modify the source of pip in Python, you can follow the following steps:
First, find the configuration file of pip. On Windows systems, this file is usually located in C:\Users\your username\AppData\Roaming\pip\pip.ini (your username is your system username). On a Mac or Linux system, this file is usually located at ~/.pip/pip.conf.
Open the pip configuration file and add or modify the following content to specify the source you want to use:
[global] index-url = https://你的源地址/simple/
Replace https://your source address/simple/ with what you want The source address to use. For example, if you want to use Alibaba Cloud's source, you can replace https://your source address/simple/ with https://mirrors.aliyun.com/pypi/simple/.
Save the configuration file and close.
Now, when you use pip to install a Python package, it will download the package from the source address you specify.
The above is the detailed content of How to modify pip source in python. For more information, please follow other related articles on the PHP Chinese website!