In this paper, an approach based on linear programming (LP) is proposed for path planning in three-dimensional space, in which an aerial vehicle is requested to pursue a target while avoiding static or dynamic obstacles. This problem is very meaningful for many aerial robots, such as unmanned aerial vehicles. First, the tasks of target-pursuit and obstacle-avoidance are modelled with linear constraints in relative coordination according to LP formulation. Then, two weighted cost functions, representing the optimal velocity resolution, are integrated into the final objective function. This resolution, defined to achieve the optimal velocity, deals with the optimization of a pair of orthogonal vectors. Some constraints, such as boundaries of the vehicle velocity, acceleration, sensor range, and flying height, are considered in this method. A number of simulations, under static and dynamic environments, are carried out to validate the performance of generating optimal trajectory in real time. Compared with ant colony optimization algorithm and genetic algorithm, our method has less parameters to tune and can achieve better performance in real-time application.