zoukankan      html  css  js  c++  java
  • 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文件的程序,我把它删除掉,就不会报这种错了。

      

      

  • 相关阅读:
    gnuplot
    charles证书安装
    jenkins 配置ssh
    jenkins 配置slave
    centos 安装jenkins
    mac的一些命令
    docker 常用命令
    GO vim环境
    go vendor目录
    protobuf
  • 原文地址:https://www.cnblogs.com/hum0ro/p/9536010.html
Copyright © 2011-2022 走看看