当前位置:   article > 正文

bash: pip: command not found_-bash: pip: command not found

-bash: pip: command not found

随笔 

不同系统安装pip command

目录

1. 对于 CentOS/RHEL 系统

1.1 安装 phthon3-pip

1.2  执行 pip3 install -r requirments.txt 即可执行

2. 对于 Debian/Ubuntu 系统

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

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

4.1 首先,下载 get-pip.py 脚本

4.2 在脚本所在的目录下执行以下命令安装 pip


1. 对于 CentOS/RHEL 系统

1.1 安装 phthon3-pip
  1. 1. sudo yum install python3-pip
  2. 2. 安装完成后,执行 pip3 install -r requirments.txt 即可执行
  3. root@bogon NDPPPlatform]#
  4. [root@bogon NDPPPlatform]# pip install -r requirements.txt
  5. bash: pip: command not found...
  6. [root@bogon NDPPPlatform]#
  7. [root@bogon NDPPPlatform]#
  8. [root@bogon NDPPPlatform]# yum install python3-pip
  9. Last metadata expiration check: 1:43:38 ago on Thu 09 May 2024 05:30:47 PM CST.
  10. Package python3-pip-9.0.3-22.el8.noarch is already installed.
  11. Dependencies resolved.
  12. ===============================================================================================================================================================================================================================================================================================
  13. Package Architecture Version Repository Size
  14. ===============================================================================================================================================================================================================================================================================================
  15. Upgrading:
  16. platform-python x86_64 3.6.8-62.el8 baseos 88 k
  17. platform-python-pip noarch 9.0.3-24.el8 baseos 1.7 M
  18. python3-libs x86_64 3.6.8-62.el8 baseos 8.4 M
  19. python3-pip noarch 9.0.3-24.el8 appstream 20 k
  20. Transaction Summary
  21. ===============================================================================================================================================================================================================================================================================================
  22. Upgrade 4 Packages
  23. Total download size: 10 M
  24. Is this ok [y/N]: y
  25. Downloading Packages:
  26. (1/4): python3-pip-9.0.3-24.el8.noarch.rpm 30 kB/s | 20 kB 00:00
  27. (2/4): platform-python-3.6.8-62.el8.x86_64.rpm 66 kB/s | 88 kB 00:01
  28. (3/4): platform-python-pip-9.0.3-24.el8.noarch.rpm 109 kB/s | 1.7 MB 00:16
  29. (4/4): python3-libs-3.6.8-62.el8.x86_64.rpm 81 kB/s | 8.4 MB 01:46
  30. -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
  31. Total 98 kB/s | 10 MB 01:47
  32. Running transaction check
  33. Transaction check succeeded.
  34. Running transaction test
  35. Transaction test succeeded.
  36. Running transaction
  37. Preparing : 1/1
  38. Upgrading : platform-python-pip-9.0.3-24.el8.noarch 1/8
  39. Upgrading : python3-libs-3.6.8-62.el8.x86_64 2/8
  40. Upgrading : platform-python-3.6.8-62.el8.x86_64 3/8
  41. Running scriptlet: platform-python-3.6.8-62.el8.x86_64 3/8
  42. Upgrading : python3-pip-9.0.3-24.el8.noarch 4/8
  43. Cleanup : python3-pip-9.0.3-22.el8.noarch 5/8
  44. Cleanup : platform-python-3.6.8-49.el8.x86_64 6/8
  45. Running scriptlet: platform-python-3.6.8-49.el8.x86_64 6/8
  46. Cleanup : platform-python-pip-9.0.3-22.el8.noarch 7/8
  47. Cleanup : python3-libs-3.6.8-49.el8.x86_64 8/8
  48. Running scriptlet: python3-libs-3.6.8-49.el8.x86_64 8/8
  49. Verifying : python3-pip-9.0.3-24.el8.noarch 1/8
  50. Verifying : python3-pip-9.0.3-22.el8.noarch 2/8
  51. Verifying : platform-python-3.6.8-62.el8.x86_64 3/8
  52. Verifying : platform-python-3.6.8-49.el8.x86_64 4/8
  53. Verifying : platform-python-pip-9.0.3-24.el8.noarch 5/8
  54. Verifying : platform-python-pip-9.0.3-22.el8.noarch 6/8
  55. Verifying : python3-libs-3.6.8-62.el8.x86_64 7/8
  56. Verifying : python3-libs-3.6.8-49.el8.x86_64 8/8
  57. Upgraded:
  58. 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
  59. Complete!
  60. [root@bogon NDPPPlatform]#
1.2  执行 pip3 install -r requirments.txt 即可执行
  1. 2. 安装完成pip3 后,执行 pip3 install -r requirments.txt
  2. [root@bogon NDPPPlatform]# pip3 install -r requirements.txt
  3. WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
  4. Collecting pytest (from -r requirements.txt (line 1))
  5. Downloading https://files.pythonhosted.org/packages/38/93/c7c0bd1e932b287fb948eb9ce5a3d6307c9fc619db1e199f8c8bc5dad95f/pytest-7.0.1-py3-none-any.whl (296kB)
  6. 100% |████████████████████████████████| 307kB 9.7kB/s
  7. Collecting pytest-html (from -r requirements.txt (line 2))
  8. Downloading https://files.pythonhosted.org/packages/81/e1/35ae038e10ba11758e7d572f656ea7b99795f3d37d20aa40a5d7e8050091/pytest_html-3.2.0-py3-none-any.whl
  9. Collecting pytest-xdist (from -r requirements.txt (line 3))
  10. Downloading https://files.pythonhosted.org/packages/0e/99/2b300b4391f27ba31c6ec1ce643700ee2d32f860e3877a13106ef3a30e22/pytest_xdist-3.0.2-py3-none-any.whl
  11. Collecting pytest-ordering (from -r requirements.txt (line 4))
  12. Downloading https://files.pythonhosted.org/packages/ec/98/adc368fe369465f291ab24e18b9900473786ed1afdf861ba90467eb0767e/pytest_ordering-0.6-py3-none-any.whl
  13. Collecting pytest-rerunfailures (from -r requirements.txt (line 5))
  14. Downloading https://files.pythonhosted.org/packages/89/d7/324c800be87ecf875d27070c19ced50f1eafde428eccf8c351b459e06714/pytest_rerunfailures-10.3-py3-none-any.whl
  15. Collecting allure-pytest (from -r requirements.txt (line 6))
  16. Downloading https://files.pythonhosted.org/packages/69/7b/430830ed7bf1ef078f9e55eb4b19cc059ef5310a20b5bd73eeb99e2c5ff1/allure_pytest-2.13.5-py3-none-any.whl
  17. Requirement already satisfied: requests in /usr/lib/python3.6/site-packages (from -r requirements.txt (line 7))
  18. Requirement already satisfied: PyYAML in /usr/lib64/python3.6/site-packages (from -r requirements.txt (line 8))
  19. Collecting allure-python-commons (from -r requirements.txt (line 9))
  20. Downloading https://files.pythonhosted.org/packages/d0/18/79a66d6adc301281803398f7288583dff8d1d3f2672c07ffab03ee12c7cd/allure_python_commons-2.13.5-py3-none-any.whl
  21. Collecting paramiko (from -r requirements.txt (line 10))
  22. 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/
  23. Downloading https://files.pythonhosted.org/packages/ad/50/8792484502c8141c20c996b802fefa8435a9c018a2bb440a06b172782118/paramiko-3.4.0-py3-none-any.whl (225kB)
  24. 100% |████████████████████████████████| 235kB 11kB/s
  25. Collecting configparser (from -r requirements.txt (line 11))
  26. Downloading https://files.pythonhosted.org/packages/2b/af/0e28626b47c84172a112397f034bb1b6349960ca6e0fe7c96666e0ccae69/configparser-5.2.0-py3-none-any.whl
  27. Collecting py>=1.8.2 (from pytest->-r requirements.txt (line 1))
  28. Downloading https://files.pythonhosted.org/packages/f6/f0/10642828a8dfb741e5f3fbaac830550a518a775c7fff6f04a007259b0548/py-1.11.0-py2.py3-none-any.whl (98kB)
  29. 100% |████████████████████████████████| 102kB 11kB/s
  30. Collecting iniconfig (from pytest->-r requirements.txt (line 1))
  31. Downloading https://files.pythonhosted.org/packages/9b/dd/b3c12c6d707058fa947864b67f0c4e0c39ef8610988d7baea9578f3c48f3/iniconfig-1.1.1-py2.py3-none-any.whl
  32. Collecting attrs>=19.2.0 (from pytest->-r requirements.txt (line 1))
  33. 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/
  34. Downloading https://files.pythonhosted.org/packages/fb/6e/6f83bf616d2becdf333a1640f1d463fef3150e2e926b7010cb0f81c95e88/attrs-22.2.0-py3-none-any.whl (60kB)
  35. 100% |████████████████████████████████| 61kB 10.0kB/s
  36. Collecting pluggy<2.0,>=0.12 (from pytest->-r requirements.txt (line 1))
  37. Downloading https://files.pythonhosted.org/packages/9e/01/f38e2ff29715251cf25532b9082a1589ab7e4f571ced434f98d0139336dc/pluggy-1.0.0-py2.py3-none-any.whl
  38. Collecting importlib-metadata>=0.12; python_version < "3.8" (from pytest->-r requirements.txt (line 1))
  39. Downloading https://files.pythonhosted.org/packages/a0/a1/b153a0a4caf7a7e3f15c2cd56c7702e2cf3d89b1b359d1f1c5e59d68f4ce/importlib_metadata-4.8.3-py3-none-any.whl
  40. Collecting tomli>=1.0.0 (from pytest->-r requirements.txt (line 1))
  41. Downloading https://files.pythonhosted.org/packages/05/e4/74f9440db36734d7ba83c574c1e7024009ce849208a41f90e94a134dc6d1/tomli-1.2.3-py3-none-any.whl
  42. Collecting packaging (from pytest->-r requirements.txt (line 1))
  43. Downloading https://files.pythonhosted.org/packages/05/8e/8de486cbd03baba4deef4142bd643a3e7bbe954a784dc1bb17142572d127/packaging-21.3-py3-none-any.whl (40kB)
  44. 100% |████████████████████████████████| 40kB 14kB/s
  45. Collecting pytest-metadata (from pytest-html->-r requirements.txt (line 2))
  46. Downloading https://files.pythonhosted.org/packages/e5/12/bfb677aad996cc994efb9c61289a4994d60079587e85155738859fd3b68e/pytest_metadata-1.11.0-py2.py3-none-any.whl
  47. Collecting execnet>=1.1 (from pytest-xdist->-r requirements.txt (line 3))
  48. Downloading https://files.pythonhosted.org/packages/81/c0/3072ecc23f4c5e0a1af35e3a222855cfd9c80a1a105ca67be3b6172637dd/execnet-1.9.0-py2.py3-none-any.whl
  49. Requirement already satisfied: chardet<3.1.0,>=3.0.2 in /usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 7))
  50. Requirement already satisfied: idna<2.8,>=2.5 in /usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 7))
  51. Requirement already satisfied: urllib3<1.25,>=1.21.1 in /usr/lib/python3.6/site-packages (from requests->-r requirements.txt (line 7))
  52. Collecting bcrypt>=3.2 (from paramiko->-r requirements.txt (line 10))
  53. Downloading https://files.pythonhosted.org/packages/8c/ae/3af7d006aacf513975fd1948a6b4d6f8b4a307f8a244e1a3d3774b297aad/bcrypt-4.0.1.tar.gz
  54. Complete output from command python setup.py egg_info:
  55. =============================DEBUG ASSISTANCE==========================
  56. If you are seeing an error here please try the following to
  57. successfully install bcrypt:
  58. Upgrade to the latest pip and try again. This will fix errors for most
  59. users. See: https://pip.pypa.io/en/stable/installing/#upgrading-pip
  60. =============================DEBUG ASSISTANCE==========================
  61. Traceback (most recent call last):
  62. File "<string>", line 1, in <module>
  63. File "/tmp/pip-build-97uw71mt/bcrypt/setup.py", line 11, in <module>
  64. from setuptools_rust import RustExtension
  65. ModuleNotFoundError: No module named 'setuptools_rust'
  66. ----------------------------------------
  67. Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-97uw71mt/bcrypt/
  68. [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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小惠珠哦/article/detail/793167
推荐阅读
相关标签
  

闽ICP备14008679号