HCF 发表于 2020-10-20 21:10:17

运行出错

import requests #导入
if __name__ == "__main__":
    url = 'https://www.bilibili.com/'
    response = requests.get(url=url)
    page_text = response.text
    print(page_text)
    with open('./blbl.html','w',encoding='utf-8') as fp:
      fp.write(page_text)
    print('爬取数据介绍')




出现了错误,C:\Users\华硕\AppData\Local\Programs\Python\Python38\python.exe E:/python/program1/抓包/qq音乐.py
Traceback (most recent call last):
File "E:/python/program1/抓包/qq音乐.py", line 4, in <module>
    response = requests.get(url=url)
AttributeError: module 'requests' has no attribute 'get'

Process finished with exit code 1
请问下怎么解决,网上查了是改名字,改了但还是这样,请大佬们指教

1q23w31 发表于 2020-10-20 22:24:02

是否安装了多个版本的python?

HCF 发表于 2020-10-20 23:27:29

1q23w31 发表于 2020-10-20 22:24
是否安装了多个版本的python?

貌似有,会有影响的嘛

1q23w31 发表于 2020-10-24 12:15:31

HCF 发表于 2020-10-20 23:27
貌似有,会有影响的嘛

会的,可能模块安装到了另一个python上
页: [1]
查看完整版本: 运行出错