This paper studies an unmanned aerial vehicle (UAV)-assisted Internet of Things (IoT) data collection system, where a UAV is employed as a data collection platform for a group of ground IoT devices. Our objective is to minimize the energy consumption of this system by optimizing the UAV's deployment, including the number and locations of stop points of the UAV. When using evolutionary algorithms to solve this UAV's deployment problem, each individual usually represents an entire deployment. Since the number of stop points is unknown a priori, the length of each individual in the population should be varied during the optimization process. Under this condition, the UAV's deployment is a variable-length optimization problem and the traditional fixed-length mutation and crossover operators should be modified. In this paper, we propose a differential evolution algorithm with a variable population size, called DEVIPS, for optimizing the UAV's deployment. In DEVIPS, the location of each stop point is encoded into an individual, and thus the whole population represents an entire deployment. Over the course of evolution, differential evolution is employed to produce offspring. Afterward, we design a strategy to adjust the population size according to the performance improvement. By this strategy, the number of stop points can be increased, reduced, or kept unchanged adaptively. In DEVIPS, since each individual has a fixed length, the UAV's deployment becomes a fixed-length optimization problem and the traditional fixed-length mutation and crossover operators can be used directly. The performance of DEVIPS is compared with that of five algorithms on a set of instances. The experimental studies demonstrate its effectiveness.