强化学习编写GYM环境时,检测环境遇到: TypeError: __init__() takes 1 positional argument but 2 were given

Traceback (most recent call last):
File "C:\Users\ldm25\PycharmProjects\pythonProject21\main.py", line 81, in
env = MazeEnv(gym.Env)
TypeError: init() takes 1 positional argument but 2 were given


```python
import math
import gym
import numpy as np
from gym import spaces
from stable_baselines3 import PPO
from stable_baselines3.common.env_checker import check_env
from stable_baselines3.common.vec_env import DummyVecEnv
from stable_baselines3.common.env_util import make_vec_env
from gym import Env


class MazeEnv(Env):
    def __init__(self):
        self.grid_size = 20
        self.barriers = [(3, 3), (4, 10), (6, 15), (8, 5), (10, 2), (12, 11), (14, 7), (13, 18), (18, 15)]
        self.start_pos = np.array([0, 0])
        self.goal_pos = np.array([16, 19])
        self.action_space = spaces.Box(low=-math.pi, high=math.pi, shape=(1,))
        self.observation_space = spaces.Box(low=0, high=self.grid_size, shape=(2,))
        self.max_steps = 1000
        self.current_step = 0
        self.viewer = None
        self.reward_range = (-1, 1)
        self._seed()

    def _seed(self, seed=None):
        self.np_random, seed = gym.utils.seeding.np_random(seed)
        return [seed]

    def _get_distance_to_barrier(self, pos):
        distances = [np.linalg.norm(np.array(pos) - np.array(b)) for b in self.barriers]
        return min(distances)

    def _get_state(self, a):
        next_pos = self.current_pos + 3 * np.array([math.cos(a), math.sin(a)])
        while self._get_distance_to_barrier(next_pos) < 3:
            a = self.action_space.sample()[0]
            next_pos = self.current_pos + 3 * np.array([math.cos(a), math.sin(a)])
        return next_pos

    def _get_reward(self):
        if np.array_equal(self.current_pos, self.goal_pos):
            return 1
        else:
            return -0.1

    def _is_done(self):
        if np.array_equal(self.current_pos, self.goal_pos):
            return True
        elif self.current_step >= self.max_steps:
            return True
        else:
            return False

    def _render_maze(self):
        screen_width = 600
        screen_height = 600
        cell_width = screen_width / self.grid_size
        cell_height = screen_height / self.grid_size

        if self.viewer is None:
            from gym.envs.classic_control import rendering
            self.viewer = rendering.Viewer(screen_width, screen_height)

            # draw barriers
            for b in self.barriers:
                x, y = b
                barrier = rendering.FilledPolygon([(x * cell_width, y * cell_height),
                                                   ((x + 1) * cell_width, y * cell_height),
                                                   ((x + 1) * cell_width, (y + 1) * cell_height),
                                                   (x * cell_width, (y + 1) * cell_height)])
                barrier.set_color(0, 0, 0)
                self.viewer.add_geom(barrier)

            # draw start position
            start = rendering.make_circle(cell_width / 2, 30, True)
            start.set_color(0, 1, 0)
            self.start_trans = rendering.Transform()
            start.add

env = MazeEnv(gym.Env)
# It will check your custom environment and output additional warnings if needed
check_env(env)

```