首先,通过命令安装pip3,前提是确保在kali Linux中python3已经安装
#安装命令
apt install python3-pip
#或者通过脚本安装
curl https://bootstrap.pypa.io/get-pip.py -o get-pip3.py python3 get-pip3.py & pip3 list
通过上述的命令能够正常的安装pip3
问题:安装pip2的时候出现问题
失败1:通过命令安装pip2,
#安装命令
apt install python-pip
#或者通过脚本安装
curl https://bootstrap.pypa.io/pip/2.7/get-pip.py -o get-pip2.py python2 get-pip2.py
安装是能够正常的安装进行,但执行的时候会出现问题
命令执行出现问题

通过CSDN,博客园等搜索信息,发现一个比较详细的

#执行命令下载get-pip.py
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py

#然后使用Python 2运行该脚本
python2 get-pip.py
#执行命令后,发现提示报错
WARNING: The scripts pip, pip2 and pip2.7 are installed in '/home/kali/.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.

#执行命令
sudo apt-get install python2-dev
#执行命令运行部分省略


#执行命令
python2 get-pip.py
┌──(kali㉿kali)-[~]
└─$ python2 get-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
Using cached pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.3.4
Uninstalling pip-20.3.4:
Successfully uninstalled pip-20.3.4
WARNING: The scripts pip, pip2 and pip2.7 are installed in '/home/kali/.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
#再次尝试pip -Version
还是无法无法查看pip2
┌──(kali㉿kali)-[~]
└─$ pip2 -Version
Command 'pip2' not found, did you mean:
command 'pipx' from deb pipx
command 'nip2' from deb nip2
command 'pip' from deb python3-pip
command 'pip3' from deb python3-pip
Try: sudo apt install <deb name>
成功的执行过程
Kali中没有pip2,需要Python2环境来安装模块的话,就会提示pip2不是内部或者外部命令,这个时候需要自己去安装pip2
Step 1:下载get-pip.py
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py

Step 2:python执行get-pip.py
sudo python2 get-pip.py

Step 3:验证环境
pip2 -V
看到下面的截图,就是安装成功了
Step 4:使用pip2安装第三方库和包
pip2 install 模块名字
2908

被折叠的 条评论
为什么被折叠?



