【hacker的错误集】AttributeError:module ‘requests‘ has no attribute ‘get‘

简介: 今天,在给一个粉丝远程解决技术问题的时候,发现的一个大家可能都会犯的错误


4342c163fb3943cba40472af2b1fa49b.jpg


报错内容



今天,在给一个粉丝远程解决技术问题的时候,发现的一个大家可能都会犯的错误

错误内容如下:

2287a6058e1b4c97b1236ec1936e0ffd.png


报错分析



AttributeError:module ‘requests’ has no attribute ‘get’,依旧是使用单词的意思来分析报错原因


AttributeError 属性错误

module 模块

分析可以得出:属性错误:requests没有get属性

居然:好家伙,这咋办啊

hacker:慌什么慌,其实很好解决啦


解决方案



解决方案很简单大家注意他的模块名和文件名都是requests


a0c0b9090bd04b01be334512f57d0684.png


居然:好像是的哦,那应该怎么解决啊


hacker:来,我给你讲讲哈


其实很简单,因为他的模块名和文件名冲突了,当他导入这个库时系统会觉得他导入的是requests.py这个文件,所有会报错,只需要把文件名修改一下就行了

居然:那应该怎么修改啊


hacker:很简单啊,鼠标右键项目,点击Refactor—>Rename修改一下点击Refator就行了

12b61418e39b46d3b0e16e020b63b9b0.png6ab75d24c61945c0952c2a776216bd6a.png


修改完再运行一下看看是否解决了


c12420ecf4484b32b99b4d662b679569.png


完美解决🥳🥳🥳

居然:还得是你啊

hacker:嘻嘻嘻👀👀👀


fc523ae33db145269e860d4a995625d4.jpg

目录
相关文章
|
Linux Windows
AttributeError: module ‘websocket‘ has no attribute ‘enableTrace‘
AttributeError: module ‘websocket‘ has no attribute ‘enableTrace‘
635 0
AttributeError: module ‘websocket‘ has no attribute ‘enableTrace‘
解决办法:ImportError: 'module' object has no attribute 'check_specifier'
解决办法:ImportError: 'module' object has no attribute 'check_specifier'
104 0
|
Python
AttributeError: module ‘time‘ has no attribute ‘clock‘的解决方法
在python3.10中flask项目运行报错: AttributeError: module 'time' has no attribute 'clock'解决方案 主要原因是因为python3.10中不支持clock了, 需要替换成 time.perf_counter() cpmpat.py文件:
348 0
|
数据采集 Python
AttributeError: partially initialized module ‘jieba‘ has no attribute ‘cut‘ (most likely due to a ci
AttributeError: partially initialized module ‘jieba‘ has no attribute ‘cut‘ (most likely due to a ci
482 0
AttributeError: partially initialized module ‘jieba‘ has no attribute ‘cut‘ (most likely due to a ci
|
SQL 算法 小程序
【hacker的错误集】IndentationError: expected an indented block
以猜数字的小程序为例做解答,遇到这种问题该如何解决
162 0
【hacker的错误集】IndentationError: expected an indented block
【hacker的错误集】DeprecationWarning: find_element_by_* commands are deprecated.
DeprecationWarning: find_element_by_* commands are deprecated. Please use find_element() instead。依旧是使用单词意思分析报错原因
122 0
【hacker的错误集】DeprecationWarning: find_element_by_* commands are deprecated.
|
Python
AttributeError module ‘time‘ has no attribute ‘clock‘ 解决方法
在 Pycharm + Python3.8 环境中,调用 time.clock() 报错:AttributeError: module ‘time’ has no attribute ‘clock’
884 0
AttributeError module ‘time‘ has no attribute ‘clock‘ 解决方法
|
TensorFlow 算法框架/工具

热门文章

最新文章

  • 1
    流量控制系统,用正则表达式提取汉字
    25
  • 2
    Redis09-----List类型,有序,元素可以重复,插入和删除快,查询速度一般,一般保存一些有顺序的数据,如朋友圈点赞列表,评论列表等,LPUSH user 1 2 3可以一个一个推
    26
  • 3
    Redis08命令-Hash类型,也叫散列,其中value是一个无序字典,类似于java的HashMap结构,Hash结构可以将对象中的每个字段独立存储,可以针对每字段做CRUD
    25
  • 4
    Redis07命令-String类型字符串,不管是哪种格式,底层都是字节数组形式存储的,最大空间不超过512m,SET添加,MSET批量添加,INCRBY age 2可以,MSET,INCRSETEX
    27
  • 5
    S外部函数可以访问函数内部的变量的闭包-闭包最简单的用不了,闭包是内层函数+外层函数的变量,简称为函数套函数,外部函数可以访问函数内部的变量,存在函数套函数
    23
  • 6
    Redis06-Redis常用的命令,模糊的搜索查询往往会对服务器产生很大的压力,MSET k1 v1 k2 v2 k3 v3 添加,DEL是删除的意思,EXISTS age 可以用来查询是否有存在1
    30
  • 7
    Redis05数据结构介绍,数据结构介绍,官方网站中看到
    21
  • 8
    JS字符串数据类型转换,字符串如何转成变量,+号只要有一个是字符串,就会把另外一个转成字符串,- * / 都会把数据转成数字类型,数字型控制台是蓝色,字符型控制台是黑色,
    19
  • 9
    JS数组操作---删除,arr.pop()方法从数组中删除最后一个元素,并返回该元素的值,arr.shift() 删除第一个值,arr.splice()方法,删除指定元素,arr.splice,从第一
    19
  • 10
    定义好变量,${age}模版字符串,对象可以放null,检验数据类型console.log(typeof str)
    19