使用 unittest模块运行程序报错AttributeError: module ‘unittest’ has no attribute ‘TestCase’ 1、原因是,我们新建python file的时候使用了unittest这个名字 2、解决方法:把unittest 包的名字 改成别的名字,不要使用模块名 大家千万不要用库的名称命名,特别是刚刚入门的时候。文件夹、文件,都不要用库的名称。一旦与库重名,就会出现这种 AttributeError。