在终端运行.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. js 表单提交

    方式一: 使用input type="submit" 提交 <form action="http://www.w3school.com.cn/tiy/loadtex ...

  2. luogu3731 新型城市化

    题目链接 思路 这道题对于题意的转化很关键. 题目要求的是添上一条边,使得图中最大团的大小变大.给出的边是原图的补集,这就给我们了提示. 因为题目中说,原图中最多有两个团.所以给出的边一定形成了一个二 ...

  3. Day019--Python--反射

    1. issubclass, type, isinstance issubclass 判断XXX类是否是XXX类的子类 type 给出XXX的数据类型. 给出创建这个对象的类 isinstance 判 ...

  4. Linux设备树(一 概述)

    一 概述 设备树(Device tree)是一套用来描述硬件属相的规则.ARM Linux采用设备树机制源于2011年3月份Linux创始人Linus Torvalds发的一封邮件,在这封邮件中他提倡 ...

  5. PHP下安装memcached

    tar xvf libevent-2.0.21-stable.tar.gzcd libevent./configure -prefix=/usr/local/libeventmake &&am ...

  6. cmd解压压缩包

    需要安装有winrar start winrar x C:\Users\systme\Desktop\xxx.rar c:\123

  7. 用count sql做jmeter的while条件

    ${__groovy(vars.get("pboc_req_record_counter_1") == "Invalid"  || vars.get(" ...

  8. python OrderDict

    # encoding: utf-8 import csv import collections d = {'banana':3,'apple':4,'pear':1,'orange':2} print ...

  9. 网速测试脚本speedtest_cli的安装与使用

    speedtest_cli的安装与使用 1.下载 wget https://raw.github.com/sivel/speedtest-cli/master/speedtest.py 图 1 2.授 ...

  10. Mybatis笔记二:接口式编程

    目录 旧方法的弊端 接口式编程 接口式编程的好处 接口式编程的增删改查 旧方法的弊端 在Mybatis笔记一中,我们使用命名空间+id的方式实现了Mybatis的执行,不过这里的命名空间是我们随便写的 ...