bash: pip: command not found

随笔

不同系统安装pip command

目录

[1. 对于 CentOS/RHEL 系统](#1. 对于 CentOS/RHEL 系统)

[1.1 安装 phthon3-pip](#1.1 安装 phthon3-pip)

[1.2 执行 pip3 install -r requirments.txt 即可执行](#1.2 执行 pip3 install -r requirments.txt 即可执行)

[2. 对于 Debian/Ubuntu 系统](#2. 对于 Debian/Ubuntu 系统)

[3. 有些 Linux 发行版可能默认使用 python2](#3. 有些 Linux 发行版可能默认使用 python2)

[4. 如果你已经安装了 python3,可尝试通过 get-pip.py 脚本安装](#4. 如果你已经安装了 python3,可尝试通过 get-pip.py 脚本安装)

[4.1 首先,下载 get-pip.py 脚本](#4.1 首先,下载 get-pip.py 脚本)

[4.2 在脚本所在的目录下执行以下命令安装 pip](#4.2 在脚本所在的目录下执行以下命令安装 pip)


1. 对于 CentOS/RHEL 系统

1.1 安装 phthon3-pip
1. sudo yum install python3-pip

2. 安装完成后,执行 pip3 install -r requirments.txt 即可执行


root@bogon NDPPPlatform]# 
[root@bogon NDPPPlatform]# pip install -r requirements.txt 
bash: pip: command not found...
[root@bogon NDPPPlatform]# 
[root@bogon NDPPPlatform]# 
[root@bogon NDPPPlatform]# yum install python3-pip
Last metadata expiration check: 1:43:38 ago on Thu 09 May 2024 05:30:47 PM CST.
Package python3-pip-9.0.3-22.el8.noarch is already installed.
Dependencies resolved.
===============================================================================================================================================================================================================================================================================================
 Package                                                                      Architecture                                                    Version                                                                 Repository                                                          Size
===============================================================================================================================================================================================================================================================================================
Upgrading:
 platform-python                                                              x86_64                                                          3.6.8-62.el8                                                            baseos                                                              88 k
 platform-python-pip                                                          noarch                                                          9.0.3-24.el8                                                            baseos                                                             1.7 M
 python3-libs                                                                 x86_64                                                          3.6.8-62.el8                                                            baseos                                                             8.4 M
 python3-pip                                                                  noarch                                                          9.0.3-24.el8                                                            appstream                                                           20 k

Transaction Summary
===============================================================================================================================================================================================================================================================================================
Upgrade  4 Packages

Total download size: 10 M
Is this ok [y/N]: y
Downloading Packages:
(1/4): python3-pip-9.0.3-24.el8.noarch.rpm                                                                                                                                                                                                                      30 kB/s |  20 kB     00:00    
(2/4): platform-python-3.6.8-62.el8.x86_64.rpm                                                                                                                                                                                                                  66 kB/s |  88 kB     00:01    
(3/4): platform-python-pip-9.0.3-24.el8.noarch.rpm                                                                                                                                                                                                             109 kB/s | 1.7 MB     00:16    
(4/4): python3-libs-3.6.8-62.el8.x86_64.rpm                                                                                                                                                                                                                     81 kB/s | 8.4 MB     01:46    
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                                           98 kB/s |  10 MB     01:47     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                                       1/1 
  Upgrading        : platform-python-pip-9.0.3-24.el8.noarch                                                                                                                                                                                                                               1/8 
  Upgrading        : python3-libs-3.6.8-62.el8.x86_64                                                                                                                                                                                                                                      2/8 
  Upgrading        : platform-python-3.6.8-62.el8.x86_64                                                                                                                                                                                                                                   3/8 
  Running scriptlet: platform-python-3.6.8-62.el8.x86_64                                                                                                                                                                                                                                   3/8 
  Upgrading        : python3-pip-9.0.3-24.el8.noarch                                                                                                                                                                                                                                       4/8 
  Cleanup          : python3-pip-9.0.3-22.el8.noarch                                                                                                                                                                                                                                       5/8 
  Cleanup          : platform-python-3.6.8-49.el8.x86_64                                                                                                                                                                                                                                   6/8 
  Running scriptlet: platform-python-3.6.8-49.el8.x86_64                                                                                                                                                                                                                                   6/8 
  Cleanup          : platform-python-pip-9.0.3-22.el8.noarch                                                                                                                                                                                                                               7/8 
  Cleanup          : python3-libs-3.6.8-49.el8.x86_64                                                                                                                                                                                                                                      8/8 
  Running scriptlet: python3-libs-3.6.8-49.el8.x86_64                                                                                                                                                                                                                                      8/8 
  Verifying        : python3-pip-9.0.3-24.el8.noarch                                                                                                                                                                                                                                       1/8 
  Verifying        : python3-pip-9.0.3-22.el8.noarch                                                                                                                                                                                                                                       2/8 
  Verifying        : platform-python-3.6.8-62.el8.x86_64                                                                                                                                                                                                                                   3/8 
  Verifying        : platform-python-3.6.8-49.el8.x86_64                                                                                                                                                                                                                                   4/8 
  Verifying        : platform-python-pip-9.0.3-24.el8.noarch                                                                                                                                                                                                                               5/8 
  Verifying        : platform-python-pip-9.0.3-22.el8.noarch                                                                                                                                                                                                                               6/8 
  Verifying        : python3-libs-3.6.8-62.el8.x86_64                                                                                                                                                                                                                                      7/8 
  Verifying        : python3-libs-3.6.8-49.el8.x86_64                                                                                                                                                                                                                                      8/8 

Upgraded:
  platform-python-3.6.8-62.el8.x86_64                                     platform-python-pip-9.0.3-24.el8.noarch                                     python3-libs-3.6.8-62.el8.x86_64                                     python3-pip-9.0.3-24.el8.noarch                                    

Complete!
[root@bogon NDPPPlatform]# 
1.2 执行 pip3 install -r requirments.txt 即可执行
2. 安装完成pip3 后,执行 pip3 install -r requirments.txt 

[root@bogon NDPPPlatform]# pip3 install -r requirements.txt 
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pytest (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/38/93/c7c0bd1e932b287fb948eb9ce5a3d6307c9fc619db1e199f8c8bc5dad95f/pytest-7.0.1-py3-none-any.whl (296kB)
    100% |████████████████████████████████| 307kB 9.7kB/s 
Collecting pytest-html (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/81/e1/35ae038e10ba11758e7d572f656ea7b99795f3d37d20aa40a5d7e8050091/pytest_html-3.2.0-py3-none-any.whl
Collecting pytest-xdist (from -r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/0e/99/2b300b4391f27ba31c6ec1ce643700ee2d32f860e3877a13106ef3a30e22/pytest_xdist-3.0.2-py3-none-any.whl
Collecting pytest-ordering (from -r requirements.txt (line 4))
  Downloading https://files.pythonhosted.org/packages/ec/98/adc368fe369465f291ab24e18b9900473786ed1afdf861ba90467eb0767e/pytest_ordering-0.6-py3-none-any.whl
Collecting pytest-rerunfailures (from -r requirements.txt (line 5))
  Downloading https://files.pythonhosted.org/packages/89/d7/324c800be87ecf875d27070c19ced50f1eafde428eccf8c351b459e06714/pytest_rerunfailures-10.3-py3-none-any.whl
Collecting allure-pytest (from -r requirements.txt (line 6))
  Downloading https://files.pythonhosted.org/packages/69/7b/430830ed7bf1ef078f9e55eb4b19cc059ef5310a20b5bd73eeb99e2c5ff1/allure_pytest-2.13.5-py3-none-any.whl
Requirement already satisfied: requests in /usr/lib/python3.6/site-packages (from -r requirements.txt (line 7))
Requirement already satisfied: PyYAML in /usr/lib64/python3.6/site-packages (from -r requirements.txt (line 8))
Collecting allure-python-commons (from -r requirements.txt (line 9))
  Downloading https://files.pythonhosted.org/packages/d0/18/79a66d6adc301281803398f7288583dff8d1d3f2672c07ffab03ee12c7cd/allure_python_commons-2.13.5-py3-none-any.whl
Collecting paramiko (from -r requirements.txt (line 10))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc002f6f400>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/paramiko/
  Downloading https://files.pythonhosted.org/packages/ad/50/8792484502c8141c20c996b802fefa8435a9c018a2bb440a06b172782118/paramiko-3.4.0-py3-none-any.whl (225kB)
    100% |████████████████████████████████| 235kB 11kB/s 
Collecting configparser (from -r requirements.txt (line 11))
  Downloading https://files.pythonhosted.org/packages/2b/af/0e28626b47c84172a112397f034bb1b6349960ca6e0fe7c96666e0ccae69/configparser-5.2.0-py3-none-any.whl
Collecting py>=1.8.2 (from pytest->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/f6/f0/10642828a8dfb741e5f3fbaac830550a518a775c7fff6f04a007259b0548/py-1.11.0-py2.py3-none-any.whl (98kB)
    100% |████████████████████████████████| 102kB 11kB/s 
Collecting iniconfig (from pytest->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl
Collecting attrs>=19.2.0 (from pytest->-r requirements.txt (line 1))
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<pip._vendor.urllib3.connection.VerifiedHTTPSConnection object at 0x7fc0026fe6d8>: Failed to establish a new connection: [Errno 101] Network is unreachable',)': /simple/attrs/
  Downloading https://files.pythonhosted.org/packages/fb/6e/6f83bf616d2becdf333a1640f1d463fef3150e2e926b7010cb0f81c95e88/attrs-22.2.0-py3-none-any.whl (60kB)
    100% |████████████████████████████████| 61kB 10.0kB/s 
Collecting pluggy<2.0,>=0.12 (from pytest->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/9e/01/f38e2ff29715251cf25532b9082a1589ab7e4f571ced434f98d0139336dc/pluggy-1.0.0-py2.py3-none-any.whl
Collecting importlib-metadata>=0.12; python_version < "3.8" (from pytest->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/a0/a1/b153a0a4caf7a7e3f15c2cd56c7702e2cf3d89b1b359d1f1c5e59d68f4ce/importlib_metadata-4.8.3-py3-none-any.whl
Collecting tomli>=1.0.0 (from pytest->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/05/e4/74f9440db36734d7ba83c574c1e7024009ce849208a41f90e94a134dc6d1/tomli-1.2.3-py3-none-any.whl
Collecting packaging (from pytest->-r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl (40kB)
    100% |████████████████████████████████| 40kB 14kB/s 
Collecting pytest-metadata (from pytest-html->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/e5/12/bfb677aad996cc994efb9c61289a4994d60079587e85155738859fd3b68e/pytest_metadata-1.11.0-py2.py3-none-any.whl
Collecting execnet>=1.1 (from pytest-xdist->-r requirements.txt (line 3))
  Downloading https://files.pythonhosted.org/packages/81/c0/3072ecc23f4c5e0a1af35e3a222855cfd9c80a1a105ca67be3b6172637dd/execnet-1.9.0-py2.py3-none-any.whl
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 7))
Requirement already satisfied: idna<2.8,>=2.5 in /usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 7))
Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 7))
Collecting bcrypt>=3.2 (from paramiko->-r requirements.txt (line 10))
  Downloading https://files.pythonhosted.org/packages/8c/ae/3af7d006aacf513975fd1948a6b4d6f8b4a307f8a244e1a3d3774b297aad/bcrypt-4.0.1.tar.gz
    Complete output from command python setup.py egg_info:
    
            =============================DEBUG ASSISTANCE==========================
            If you are seeing an error here please try the following to
            successfully install bcrypt:
    
            Upgrade to the latest pip and try again. This will fix errors for most
            users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
            =============================DEBUG ASSISTANCE==========================
    
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-97uw71mt/bcrypt/setup.py", line 11, in <module>
        from setuptools_rust import RustExtension
    ModuleNotFoundError: No module named 'setuptools_rust'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-97uw71mt/bcrypt/
[root@bogon NDPPPlatform]# 

2. 对于 Debian/Ubuntu 系统

sudo apt install python3-pip

3. 有些 Linux 发行版可能默认使用 python2

# sudo apt install python-pip

4. 如果你已经安装了 python3,可尝试通过 get-pip.py 脚本安装

4.1 首先,下载 get-pip.py 脚本
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
4.2 在脚本所在的目录下执行以下命令安装 pip
sudo python3 get-pip.py
相关推荐
PythonFun14 分钟前
Python批量下载PPT模块并实现自动解压
开发语言·python·powerpoint
Death20018 分钟前
Qt 6 相比 Qt 5 的主要提升与更新
开发语言·c++·qt·交互·数据可视化
机器视觉知识推荐、就业指导20 分钟前
使用Qt实现实时数据动态绘制的折线图示例
开发语言·qt
炼丹师小米44 分钟前
Ubuntu24.04.1系统下VideoMamba环境配置
python·环境配置·videomamba
GFCGUO1 小时前
ubuntu18.04运行OpenPCDet出现的问题
linux·python·学习·ubuntu·conda·pip
快乐就好ya1 小时前
Java多线程
java·开发语言
CS_GaoMing2 小时前
Centos7 JDK 多版本管理与 Maven 构建问题和注意!
java·开发语言·maven·centos7·java多版本
985小水博一枚呀2 小时前
【深度学习基础模型】神经图灵机(Neural Turing Machines, NTM)详细理解并附实现代码。
人工智能·python·rnn·深度学习·lstm·ntm
2401_858120533 小时前
Spring Boot框架下的大学生就业招聘平台
java·开发语言
转调3 小时前
每日一练:地下城游戏
开发语言·c++·算法·leetcode