AttributeError:“<无效类型>"对象没有属性“退出" [英] AttributeError: '<invalid type>' object has no attribute 'exit'

查看:136
本文介绍了AttributeError:“<无效类型>"对象没有属性“退出"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

运行from sys import exit时引发错误:Line 2: AttributeError: '<invalid type>' object has no attribute 'exit'.我该如何解决?代码的问题部分:

Throws error: Line 2: AttributeError: '<invalid type>' object has no attribute 'exit' when from sys import exit is run. How do I fix this? Problem part of code:

from sys import exit

推荐答案

您是否偶然创建了名为sys的模块或文件?如果是这样,则是从本地模块而不是从内置的Python sys模块

Did you happen to create a module or file called sys? If so you are importing from your local module rather than from the built-in Python sys module

否则,这些导入命令区分大小写,请确保所有内容均使用小写(在您的帖子中,但您永远不会知道):

Otherwise, these import commands are case sensitive, make sure everything is in lower case (it is in your post, but you never know):

from sys import exit

这篇关于AttributeError:“&lt;无效类型&gt;"对象没有属性“退出"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆