An electric vehicle provided with a battery compartment comprising a vehicle body, a chassis, and electric drive system, a cab and a control system, wherein the electric drive system includes the battery compartment and the battery compartment is fixed below the chassis; the battery compartment has a rectangular cavity with a battery inlet at one end; an automatic battery in-out guiding device is provided inside the rectangular cavity of the battery compartment; the battery inlet (8.1) faces front, rear or lateral along a driving direction of the electric vehicle and the automatic battery in-out guiding device in the battery compartment is controlled by the control system, characterized in that the rectangular cavity with the battery inlet (8.1) at one end includes a battery connection socket at an end opposite the battery inlet (8.1) for connection to a connector plug of a battery, and in that the automatic battery in-out guiding device includes rollers, a motor, a motor controller and a synchronous drive belt which are provided at a bottom surface of the rectangular cavity of the battery compartment; the control system controls the motor to drive the rollers to rotate forward or reverse through the motor controller to push out a battery or move a battery into the battery compartment, and in that a top of the battery compartment is a removable top cover; one or more batteries is placed in the rectangular cavity; the battery includes a casing, a battery core and circuits which are provided in the casing; one end of the casing is provided with the connector plug and the other end of the casing is provided with a connector socket, the connector plug of the battery is connected to the connector socket through the circuits in the casing; the bottom surface of the rectangular cavity of the battery compartment is provided with a plurality of battery positioning devices which respectively corresponds to each battery; and in that the casing of the battery is a rectangular parallelepiped, and the casing or the battery core is provided with an electronic tag and a network module; rotating wheels (3,7) are provided on lateral surfaces or a top surface of the casing. characterized in that the rectangular cavity with the battery inlet (8.1) at one end includes a battery connection socket at an end opposite the battery inlet (8.1) for connection to a connector plug of a battery, and in that the automatic battery in-out guiding device includes rollers, a motor, a motor controller and a synchronous drive belt which are provided at a bottom surface of the rectangular cavity of the battery compartment; the control system controls the motor to drive the rollers to rotate forward or reverse through the motor controller to push out a battery or move a battery into the battery compartment, and in that a top of the battery compartment is a removable top cover; one or more batteries is placed in the rectangular cavity; the battery includes a casing, a battery core and circuits which are provided in the casing; one end of the casing is provided with the connector plug and the other end of the casing is provided with a connector socket, the connector plug of the battery is connected to the connector socket through the circuits in the casing; the bottom surface of the rectangular cavity of the battery compartment is provided with a plurality of battery positioning devices which respectively corresponds to each battery; and in that the casing of the battery is a rectangular parallelepiped, and the casing or the battery core is provided with an electronic tag and a network module; rotating wheels (3,7) are provided on lateral surfaces or a top surface of the casing.