问题
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
回答1:
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
来源:https://stackoverflow.com/questions/37555355/attributeerror-invalid-type-object-has-no-attribute-exit