Steps to install the python library with Tsinghua mirror: 1. Open the terminal or command line interface; 2. Make sure that the Tsinghua mirror source has been configured and set the Tsinghua mirror source as the default source of pip; 3. Run "pip install <package-name>" command to install the Python library; 4. If you need to install a specific version of the library, you can add the version number "pip install <package-name>@
" after the installation command.
Operating system for this tutorial: Windows 10 system, Python version 3.11.4, Dell G3 computer.
Tsinghua Mirror is a mirror site of Tsinghua University in China. It provides official mirrors of a large number of software, including Python and its related libraries and tools. Using Tsinghua mirror can speed up the software download and installation process, and can also avoid some network problems.
It is very simple to install the Python library using the Tsinghua mirror. You can follow the following steps:
1. Open the terminal or command line interface.
2. Make sure the Tsinghua mirror source has been configured. You can set the Tsinghua mirror source as the default source of pip, so that you can directly use the pip command to install the library. For the setting method, please refer to the official documentation of Tsinghua Mirror.
3. Run the following command to install the Python library:
pip install <package-name>
where
4. If you need to install a specific version of the library, you can add the version number after the installation command, for example:
pip install <package-name>@
where
Using the Tsinghua mirror to install the Python library can speed up the download and installation process, because the Tsinghua mirror provides a fast download link for the official software. In addition, some network problems can be avoided, such as DNS resolution failure, connection timeout, etc. Using Tsinghua mirrors can also ensure that the installed libraries are the latest versions from official sources, avoiding the installation of unofficial versions that have been tampered with or pose security risks.
How to set the Tsinghua image as the default source of pip?
To set the Tsinghua image as the default source of pip, you can edit the pip configuration file. Under Windows systems, you can open the C:\Users\YourUserName\AppData\Local\pip\pip.ini file. Under Linux or macOS systems, you can open the ~/.pip/pip.conf file. Add the following to the configuration file:
[global] index-url = https://pypi.tuna.tsinghua.edu.cn/simple/
The above is the detailed content of How to install python library in Tsinghua Mirror. For more information, please follow other related articles on the PHP Chinese website!