在終端運行.py文件時報錯:AttributeError: module '__main__' has no attribute 'main'
原因:在PyCharm里運行python程序需要添加
if __name__ == "__main__":
但是直接用python命令行運行時無法識別出該函數頭,刪除該函數所有內容即可!
在終端運行.py文件時報錯:AttributeError: module '__main__' has no attribute 'main'
原因:在PyCharm里運行python程序需要添加
if __name__ == "__main__":
但是直接用python命令行運行時無法識別出該函數頭,刪除該函數所有內容即可!
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。