Technology Sharing

Linux CentOS Python offline installation pip Use .whl file to install offline

2024-07-06

한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina

1. System version

cat /etc/redhat-release   #查看系统版本命令
输出:CentOS Linux release 7.9.2009 (Core)

2. In pip Official website Download the .whl file: pip-24.1.1-py3-none-any.whl

3. Installation

python -m pip install pip-24.1.1-py3-none-any.whl

3. After installation, run pip --version. If the command is not found, you need to set a soft link

pip --version

4. Run the following command to find the pip directory

find / -name pip

#在输出中找到类似目录:/usr/local/python3.8/bin/pip

5. Then create a soft link

ln -s  /usr/local/python3.8/bin/pip /usr/bin/pip

6. Execute again to view the version

pip --version
#输出:pip 24.1.1

7. If the pip installation package has a connection timeout or network problem, you can switch to the domestic mirror source, temporarily switch the mirror, and add the following information after the installation name

pip install xxxpackageName -i https://pypi.tuna.tsinghua.edu.cn/simple