无法在python2.7(Kali linux)中安装Requests模块,因为它不断出现在python3库中

问题描述 投票:0回答:4

我正在使用 kali linux,并尝试导入一个名为 requests 的模块来运行漏洞利用程序。 (https://www.exploit-db.com/exploits/47138)如果您想了解有关该漏洞的更多信息。 当我尝试运行以下命令时

sudo pip install requests

我不断得到这个结果

Requirement already satisfied: requests in /usr/lib/python3/dist-packages (2.23.0)

这根本不起作用,因为我要求请求模块位于 python2 中。

如何安装?

python python-2.7 pip python-requests
4个回答
1
投票
pip install <package> -t <directory>

-t 指定要安装软件包的目标目录

因此,在您的情况下,您可以执行 pip install requests -t "C:\Python27\Lib\site-packages" (这是我的 site-packages 文件夹所在的位置。)


1
投票

您应该使用此命令,它将确保您正在安装 python2 的模块:

python2 -m pip install --user --upgrade requests

1
投票

您可以使用以下命令:

sudo pip2.7 install requests

(假设你有Python 2.7。如果你有不同版本,请交换版本号)


0
投票

转到您的 Python 2 安装。可能是在

cd \Python27\scripts cd /lib/python2.7 (就我而言)

运行 pip 安装请求

如果成功,您将获得: 安装收集的软件包:idna、certifi、chardet、urllib3、requests 成功安装 certifi-2021.10.8 chardet-4.0.0 idna-2.10 requests-2.27.1 urllib3-1.26.18

© www.soinside.com 2019 - 2024. All rights reserved.