AttributeError: module 'requests' has no attribute 'get'的错误疑惑
我发现文件直接用requests.get(url)会提示我AttributeError: module 'requests' has no attribute 'get'
我把问题百度了一下,解决方法是:
python源文件与关键字重名了。
1. 命名py脚本时,不要与python预留字,模块名等相同
2. 删除该库的.pyc文件(因为py脚本每次运行时均会生成.pyc文件;在已经生成.pyc文件的情况下,若代码不更新,运行时依旧会走pyc,所以要删除.pyc文件),重新运行代码;或者找一个可以运行代码的环境,拷贝替换当前机器的.pyc文件即可
后来我发现我的该路径下有一个requests.py文件的程序,我把它删除掉,就不会报这种错了。
AttributeError: module 'requests' has no attribute 'get'的错误疑惑的更多相关文章
- 解决:AttributeError: module 'requests' has no attribute 'post'”
今天学习Requests库,当用pip install requests安装后,写了一段代码报错:AttributeError: module ‘requests‘ has no attribute ...
- 解决:AttributeError: module 'requests' has no attribute 'get'”
今天学习Requests库,当用pip install requests安装后,写了一段代码报错:AttributeError: module 'requests' has no attribute ...
- AttributeError: module 'requests' has no attribute 'get' 遇到了这个错误,是因为我把python关键字做了包名。。。
初学者总会犯各种低级错误,这是其一,特此记录.
- (转)Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding
基于python3.6.1版本,在一个.py文件中,加入这3行:import requests, re, sysreload(sys)sys.setdefaultencoding("utf- ...
- AttributeError: 'module' object has no attribute get'
最近在写python requests相关内容易,突然报错AttributeError: 'module' object has no attribute 'get'" 脚本肯定没问题 怎么 ...
- Python3异常-AttributeError: module 'sys' has no attribute 'setdefaultencoding'
基于python3.6.1版本,在一个.py文件中,加入这3行: import requests, re, sys reload(sys) sys.setdefaultencoding("u ...
- python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?
python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...
- Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法
最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...
- attributeError:'module' object has no attribute ** 解决办法
写了一个小脚本,执行的时候报错: Traceback (most recent call last): File "F:/test/qrcode.py", line 109, in ...
随机推荐
- JS的video在手机上有些手机能播放,而有些不能原因
一,一开始我video是这样写的,直接给地址,然后有很多手机却不能播放,或者说卡在一开始的页面,是什么原因呢? <video id='video' > <source src='xx ...
- Android生命周期例子小解
Activity 从创建到进入运行态所触发的事件 onCreate()-->onStart-->onResume() 从运行态到停止态所触发的事件 onPa ...
- java随机数Math.random()
double random=Math.random();//返回[0,1)随机数 (int)(Math.random()*6)//返回0-5:随机数 (int)(Math.random()*6+1)/ ...
- ASE Alpha Sprint - backend scrum 10
本次scrum于2019.11.15在sky garden进行,持续30分钟 参与人: Xin Kang, Zhikai Chen, Jia Ning, Hao Wang 请假: Lihao Ran, ...
- 【记录】mysql查询语句对于为null和为空字符串给出特定值处理
SELECT if(IFNULL(filedName,"指定字符串")="","指定字符串",filedName) '重命名的字符名' FR ...
- mysql02---客户端与服务器模型
目录 一.客户端与服务器模型 连接MySQL方式 总结: 二.MySQL服务器构成 三.MySQL的结构 一.客户端与服务器模型 1.mysql是一个典型的C/S服务结构 1.1 mysql自带的客户 ...
- (ACM模板)映射map
#include<iostream> #include<cstdio> #include<map> using namespace std; int main() ...
- 前端学习(三十八)vue(笔记)
Angular+Vue+React Vue性能最好,Vue最轻=======================================================Angular ...
- javascript实现下拉菜单的显示与隐藏
demo.html <!DOCTYPE html> <html lang="en"> <head> <meta charset=" ...
- Jquery datatable 配置与应用
var EcommerceOrders = function() { var initPickers = function() { //init date pickers $('.date-picke ...