首发于渗透测试

[环境搭建] Kali 下安装pip

一、Kali 下安装pip3

1.1 方法一

sudo apt-get install python3-pip

1.2 方法二

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py

二、Kali 下安装pip2

2.1 前言

由于python 推广3 版本,同时Kali 作为非常激进的系统,所以就砍掉了python 2 版本的pip 命令。但是由于很多工具使用python2 编写的,需要使用pip2 下载相关依赖模块,就有了篇文章。

2.2 安装过程

首先,去bootstrap.pypa.io 下载对应python 版本的pip。我的是pip-2.7.py

┌──(ajest AJESTdeKALI)-[~]
└─$ wget https://bootstrap.pypa.io/pip/2.7/get-pip.py                                                  
--2021-08-09 11:47:44--  https://bootstrap.pypa.io/pip/2.7/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 151.101.228.175, 2a04:4e42:11::175
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|151.101.228.175|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1908226 (1.8M) [text/x-python]
Saving to: ‘get-pip.py’

get-pip.py                 100%[=======================================>]   1.82M  1.33MB/s    in 1.4s    

2021-08-09 11:47:55 (1.33 MB/s) - ‘get-pip.py’ saved [1908226/1908226]
                                                                                                           
┌──(ajest AJESTdeKALI)-[~]
└─$ ls
01CTFer  Documents  Edraw       Music     Public  Templates  Videos
Desktop  Downloads  get-pip.py  Pictures  share   tools      vulhub
                                                                                                           
┌──(ajest AJESTdeKALI)-[~]
└─$ mv get-pip.py get-2.7-pip.py               

┌──(ajest AJESTdeKALI)-[~]
└─$ python get-2.7-pip.py                  
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Defaulting to user installation because normal site-packages is not writeable
Collecting pip<21.0
  Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
     |████████████████████████████████| 1.5 MB 730 kB/s 
Collecting wheel
  Downloading wheel-0.36.2-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, wheel
  WARNING: The scripts pip, pip2 and pip2.7 are installed in '/home/ajest/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  WARNING: The script wheel is installed in '/home/ajest/.local/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-20.3.4 wheel-0.36.2
                                                                                                           
┌──(ajest AJESTdeKALI)-[~]
└─$ 

2.3 如果遇到问题

问题一:error: invalid command 'egg_info'

pip install --upgrade setuptools

编辑于 2023-03-03 10:53・IP 属地北京