简体   繁体   English

无法在 python2.7 (Kali linux) 中安装请求模块,因为它一直出现在 python3 库中

[英]Unable to install Requests module in python2.7 (Kali linux) as it keeps appearing in python3 library

I am using kali linux and is trying to import a module called requests to run an exploit.我正在使用 kali linux 并尝试导入一个名为 requests 的模块来运行漏洞利用。 ( https://www.exploit-db.com/exploits/47138 ) if you want to know more about the exploit. ( https://www.exploit-db.com/exploits/47138 ) 如果您想了解有关该漏洞的更多信息。 when i try to run the following command当我尝试运行以下命令时

sudo pip install requests

i kept getting this result我一直得到这个结果

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

this cant work at all as i requires the Requests module to be in python2.这根本无法工作,因为我需要请求模块在 python2 中。

How can i get it installed?我怎样才能安装它?

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

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

You could use the following command:您可以使用以下命令:

sudo pip2.7 install requests

(Assuming that you have Python 2.7. If you have a different version, swap out the version number) (假设你有 Python 2.7。如果你有不同的版本,换掉版本号)

pip install <package> -t <directory>

-t specifies the target directory where you want your package to be installed -t 指定要安装包的目标目录

So in your case you can do pip install requests -t "C:\\Python27\\Lib\\site-packages" (This is where my site-packages folder is.)因此,在您的情况下,您可以执行pip install requests -t "C:\\Python27\\Lib\\site-packages" (这是我的 site-packages 文件夹所在的位置。)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM