Solution
The main reason for this error is that the gym installed is not complete enough.
When I first downloaded the gym library, I typed in
pip install gym
Later I learned that this download is the basic library
Error: gym.error.NameNotFound: Environment PongNoFrameskip doesn’t exist. Enter the following code
pip install ale-py
pip install gym[accept-rom-license]