在终端运行.py文件时报错:AttributeError: module '__main__' has no attribute 'main'

原因:在PyCharm里运行python程序需要添加

if __name__ == "__main__":

但是直接用python命令行运行时无法识别出该函数头,删除该函数所有内容即可!

AttributeError: module '__main__' has no attribute 'main'解决方法的更多相关文章

  1. 【pycharm】pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法

    pycharm上安装tensorflow,报错:AttributeError: module 'pip' has no attribute 'main' 解决方法 解决方法: 在pycharm的安装目 ...

  2. python中引入包的时候报错AttributeError: module 'sys' has no attribute 'setdefaultencoding'解决方法?

    python中引入包的时候报错:import unittestimport smtplibimport timeimport osimport sysimp.reload(sys)sys.setdef ...

  3. [开发技巧]·AttributeError: module 'pywt' has no attribute 'wavedec'解决方法

    [开发技巧]·AttributeError: module 'pywt' has no attribute 'wavedec'解决方法 1.卸载 pywt pip uninstall pywt 2.安 ...

  4. pygame模块使用时出现AttributeError: module ‘pygame’ has no attribute '…'错误解决方法

    pygame模块使用时出现AttributeError: module 'pygame' has no attribute '-'错误解决方法 首先在pygame中存在init()模块,出现这样的问题 ...

  5. Python脚本报错AttributeError: ‘module’ object has no attribute’xxx’解决方法

    最近在编写Python脚本过程中遇到一个问题比较奇怪:Python脚本完全正常没问题,但执行总报错"AttributeError: 'module' object has no attrib ...

  6. 提示AttributeError: 'module' object has no attribute 'HTTPSHandler'解决方法

    今天在新机器上安装sqlmap,运行提示AttributeError: 'module' object has no attribute 'HTTPSHandler' 网上找了找资料,发现一篇文章ht ...

  7. [已解决]pycharm报错:AttributeError: module 'pip' has no attribute 'main'

    > 更新pip后,pycharm更新模块报错,经过一番查找,现提供两种解决办法. 报错片段信息如下: AttributeError: module 'pip' has no attribute ...

  8. 解决Pycharm更新package出现的问题:AttributeError:module 'pip' has no attribute 'main'

    很久一段时间没有更新Pycharm当中的package了,今天打开Pycharm点击package更新,发生了错误,AttributeError:module 'pip' has no attribu ...

  9. 安装pandas报错(AttributeError: 'module' object has no attribute 'main')

    在pycharm中安装pandas出现报错:AttributeError: 'module' object has no attribute 'main', 刚开始以为是pip的版本太旧了,于是乎将其 ...

随机推荐

  1. A1147. Heaps

    In computer science, a heap is a specialized tree-based data structure that satisfies the heap prope ...

  2. Django(三)框架之第二篇

    https://www.cnblogs.com/haiyan123/p/7717788.html 一.知识点回顾 1.MTV模型 model:模型,和数据库相关的 template:模板,存放html ...

  3. page-break-after:always不能正常工作

    https://stackoverflow.com/questions/9595412/ie7-ie8-page-break-afteralways-not-working 最近在打印网页的时候发现 ...

  4. python测试断言

    这几天看了一下python的测试,基于函数方法和基于类的测试,主要使用的模块是unittest模块,为特定的方法和类,建立测试模块,测试函数功能是否满足预期.下面是模仿书里面的一个例子. City.p ...

  5. 解决python安装错误问题

    遇到的问题描述: An error occurred during the installation of assemblyA Microsoft.VC90. CRT, version=9-0.307 ...

  6. go 终端读写、文件读写

    go 终端读写 操作终端相关文件句柄常量 os.Stdin:标准输入 os.Stdout:标准输出 os.Stderr:标准错误输出 示例: package main import ( "b ...

  7. ssh-keygen Linux 免密登录

    一.选择算法和密钥大小 rsa - 基于分解大数的难度的旧算法.RSA建议密钥大小至少为2048位,4096位更好.RSA正在变老,并且在保理方面取得了重大进展.可能建议选择不同的算法.在可预见的将来 ...

  8. MyBatis-SqlSessionFactory的创建

    Main 方法,mybatis 版本为 3.5.0 解析配置文件的所有信息,保存在 Configuration 中,返回包含 Configuration 的 DefaultSqlSession Map ...

  9. 16.观察者模式(Observer Pattern)

    动机(Motivate):     在软件构建 过程中,我们需要为某些对象建立一种“通知依赖关系” --------一个对象(目标对象)的状态发生改变,所有的依赖对象(观察者对象)都将得到通知.如果这 ...

  10. Windows Azure中国版试用

    Winodws Azure刚出来那会都没怎么关注,就在一些网页新闻上见过一些报道,之前阿里云在博客里搞过推广,拿什么豆可以换,当时也就是看了一下没去用过. 有次在一群里别人说Windows Azure ...