Linux PIP Configuration with Baidu Source
Updated at:2025-10-20
Overview
pip is a universal Python package management tool that offers functions for finding, downloading, installing, uninstalling, and updating Python packages. This document outlines the steps to configure the pip Baidu repository based on an online BCC instance of Baidu AI Cloud with Linux images, such as CentOS and Ubuntu.
Note
Make sure you have installed pip that matches your Python version (pip comes pre-installed with Python 3.4 and above, as well as 2.7; other versions require manual installation).
Configuration method
Execute the following command in your Baidu AI Cloud instance to configure pip to use Baidu repository:
Shell
1cat > /root/.pip/pip.conf << EOF
2[global]
3index-url=http://mirrors.baidubce.com/pypi/simple/
4[install]
5trusted-host=mirrors.baidubce.com
6EOF
7cat > /root/.pydistutils.cfg << EOF
8[easy_install]
9index-url=http://mirrors.baidubce.com/pypi/simple/
10EOF
Once configured, you can use the Baidu PyPI repository to install the necessary Python libraries. Example of installation:
Plain Text
1pip3 install numpy
