pycharm运行时出现:run .pytest_cache之类的,不是直接run文件名。。。 python 中,有个pytest 模块,默认走的是这个运行模块。 命名是注意不要出现test字眼就好; 或者在run菜单栏中,去掉默认的pytest模块即可(如图)