Home > Backend Development > Python Tutorial > How to install python library in Tsinghua Mirror

How to install python library in Tsinghua Mirror

DDD
Release: 2023-11-24 14:09:41
Original
3689 people have browsed it

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.

How to install python library in Tsinghua Mirror

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>
Copy after login

where is the name of the library to be installed.

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>@
Copy after login

where is what you want to install The version number of the library.

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/
Copy after login

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!

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