Imitation learning aims to learn policy from the demonstrations of experts. Compared to reinforcement learning, which learns by trial and error, imitation learning is not limited and affected by reward functions. Therefore, more and more research is focusing on using imitation learning to help agents explore and learn, especially in reward-sparse environments. Most existing work in this area assumes that expert demonstrations include both state and action information. However, in many cases we are only provided with state-only demonstrations, which can affect policy performance. In this paper, we use a state-only demonstrations to guide agents learning in a reward-sparse environment. We propose a policy optimization from observation (POfO) method. First, we reshape the rewards by forcing occupancy measure matching between the current policy and the demonstrations, which can effectively guide agent learning. Second, we train an inverse dynamics model(IDM) for inferring and completing the missing actions in state-only demonstrations. Finally, we accelerate policy learning based on demonstrations that have been complemented by IDM. According to the experimental results, the performance of our method is comparable to that of the method using the complete demonstrations and is significantly better than other methods of the same type.