在终端运行.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. A1034. Head of a Gang

    One way that the police finds the head of a gang is to check people's phone calls. If there is a pho ...

  2. 【CF1141F2】Same Sum Blocks

    题解:发现可以通过枚举区间将区间和相同的元组记录在一个表中,对于答案来说,在同一个表中的元组的选择才会对答案产生贡献.发现每一个表中都是一个个区间,问题转化成了对于每一个表来说,选择若干个不相交的区间 ...

  3. flask 连接MogoDB数据库

    # -*- encoding: utf-8 -*- from flask import Flask,request,jsonify,render_template #导入pymongo来连接mongo ...

  4. tensorflow不同版本安装与升级/降级

    https://blog.csdn.net/junmuzi/article/details/78357371 首先,可以安装一个anaconda. 然后使用python的pip可以安装特定版本的ten ...

  5. C++ Exception机制

    C++异常机制的执行顺序. 在构造函数内抛出异常 /* * ExceptClass.h * * Created on: 2018年1月2日 * Author: jacket */ #ifndef EX ...

  6. Windows 查看端口占用情况

    今天打算运行一下当年的毕业设计,结果启动ActiveMQ的时候,发现报错 原来是端口占用了.在Windows上怎样看呢? Ctrl+Alt+Del 调出任务管理器 再找到资源监视器 原来是依赖于Erl ...

  7. 【清北学堂2018-刷题冲刺】Contest 6

    Task 1:子集 [问题描述]  若一个集合S中任意两个元素x和y,都满足x⊕y<min⁡(x, y) ,则称集合S是"好的".其中⊕为按位异或运算符.现在给定一个大小为n ...

  8. SVN YUM安装

    一,安装: yum install subversion 二,创建配置SVN仓库: 目录自定,我这是在/home下: #cd /home # mkdir svn #svnadmin create /h ...

  9. Try It Once Again

    愿你就是自己最暖的太阳.无需凭借谁的光~~~~~~~~~~~~ ============================== ============================== ====== ...

  10. jenkins配置小结

    启动jenkins:javaw -jar -Dhudson.model.DirectoryBrowserSupport.CSP= jenkins.war --httpPort=8001 wget  h ...