No matter how you run it, whether you right click on main.py or run python main.py on the command line, you will get this error
Some people on the Internet said that there was a problem of multiple python versions coexisting. I checked and found that the environment was not wrong. Finally, I suddenly remembered whether pytest-html was not installed, and it was ready to run.
pip install pytest-html