Because the traditional computing model can no longer meet the particularity of Internet of Vehicles tasks, aiming at its characteristics of high bandwidth, low latency and high reliability, this paper proposes a resource allocation strategy for Internet of Vehicles using reinforcement learning in edge cloud computing environment. First, a multi-layer resource allocation model for Internet of Vehicles is proposed, which uses the cooperation mode of edge cloud computing servers and roadside units to dynamically coordinate edge computing and content caching. Then, based on the construction of communication model, calculation model and cache model, make full use of idle resources in Internet of Vehicles to minimize network delay under the condition of limited energy consumption. Finally, the optimization goal is solved by two-layer deep Q network model, and the best resource allocation plan is obtained. The simulation results based on the Internet of Vehicles model show that the computational energy consumption and system delay of proposed strategy do not exceed 400J and 600ms respectively. Besides, the overall effect of resource allocation is better than other comparison strategies and it has certain application prospects.