在终端运行.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. [luogu3938][斐波那契]

    题目链接 思路 首先可以看出来每个月新增的兔子构成的斐波那契数列.然后每代兔子都可以用斐波那契数列中的一个数来表示.所以对于每只兔子都能在斐波那契数列中找到他所属的一个位置.因为每个兔子都是在两个月之 ...

  2. 简单ATM系统

    模拟实现一个ATM + 购物商城程序1.额度 15000或自定义2.实现购物商城,买东西加入 购物车,调用信用卡接口结账3.可以提现,手续费5%4.每月22号出账单,每月10号为还款日,过期未还,按欠 ...

  3. 苹果电脑利用wget总是会出现无法建立 SSL 连接的问题

    在做迁徙学习的过程中,需要下载已经训练好的Inception_v3模型,首先我们为了将下载的模型保存到指定的地方,我们需要利用 wget -P 想要保存的目录 模型的网址,例如 wget -P /Vo ...

  4. 2017-12-15python全栈9期第二天第七节之数字转换成布尔值

    #!/user/bin/python# -*- coding:utf-8 -*-print(bool(2))

  5. 浅谈DP

    DP是一个范围极广的一门重要的算法,它与其他算法不同的是,它并没一套固定的公式,而是通过一种特定的思路,来进行无后效性的转移.其本质是通过一个状态转移至另一状态,将问题从大化小,并找到这些小问题之间的 ...

  6. Linux下常用的shell操作

    # 设定hosts解析记录 sh-4.2# echo "$(ifconfig ens192 | awk '/\<inet\>/{print $2}') $(hostname)&q ...

  7. Docker: 安装配置入门[二]

    一.安装配置启动 1.环境 [root@docker1 ~]# cat /etc/redhat-release CentOS Linux release 7.4.1708 (Core) [root@d ...

  8. C#设计模式(11)——装饰者模式

    1.装饰者模式介绍 装饰者顾名思义就是对一个类添加一些额外的装饰(功能).我们想给一个对象添加一些额外的功能又不改变对象内方法的签名怎么做呢?最常用的方法就是继承了,子类继承父类,然后重写父类的方法. ...

  9. js中数值类型相加变成拼接字符串的问题

    如题,弱类型计算需要先进行转型,例: savNum=parseInt(savNum)+parseInt(num);或者使用 number()转型

  10. YouCompleteMe/third_party/ycmd/third_party/cregex" does not appear to contain CMakeLists.txt.

    rm -rf YouCompleteMe/third_party/ycmd/third_party/cregex git submodule update --init --recursive  at ...