Python报错:ImportError: cannot import name ‘xxx‘ from ‘xxx‘

python运行.py文件时报错:ImportError: cannot import name ‘xxx‘ from ‘xxx‘(无法从'xxx'中导入'xxx')该问题为xxx变量被二次定义(重名了)

如以下cannot importt 'Ship2' form 'ship2' ()的报错,解决方案为:查看子函数ship2内的定义是否存在一个变量在另外的子函数或者main主函数中已然被定义,找到重复定义的id,更改其名称就ok了

 

你可能感兴趣的:(python报错,python,开发语言)