python脚本上GET请求的urrlib3模块存在问题

2024-04-26 14:56:21 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试使用urllib3 python模块运行这段简单get请求代码

import urllib3

pool = urllib3.PoolManager(10)
response = pool.request('GET', 'http://google.com')
print(response.status)

response.headers.keys()
response.headers.values()

for header,value in response.headers.items():
    print(header , ":" , value)

但当我运行它时,会收到以下错误消息:

Traceback (most recent call last): File "C:\Python\Proyectos\h.e\peticiones\peticion.py", line 1, in import urllib3 ModuleNotFoundError: No module named 'urllib3'

但是我已经安装了urllib3,这是我在cmd上使用pip安装urllib3时出现的情况

Requirement already satisfied: urllib3 in c:\python\lib\site-packages (1.25.3)

那我有什么问题?我该怎么办?我现在正在使用python 3.7.3,提前谢谢


Tags: 模块代码inimportgetvalueresponserequest