With the rapid development of e-commerce industry, the efficiency of logistics and distribution has become a key constraint to its further development. In this paper, we explore the optimization of e-commerce logistics and distribution paths through the ant colony algorithm, aiming to improve the distribution efficiency and reduce the cost. The study firstly analyzes the core elements and challenges of e-commerce logistics and distribution paths, and then describes in details about the ant colony algorithm and its application to path optimization. By constructing a model adapted to the characteristics of e-commerce distribution, we use the ant colony algorithm to optimize a variety of different sizes and complexities of distribution paths. By constructing a model adapted to the characteristics of e-commerce distribution, we use the ant colony algorithm to optimize a variety of distribution paths with different sizes and complexities, and the experimental results show that the algorithm can effectively reduce the total distribution distance and cost. In the test cases, we observe that the distribution paths are shortened by 15\% on average, and the distribution cost is reduced by about 20\%. These results prove the effectiveness and feasibility of the ant colony algorithm in the optimization of e-commerce logistics distribution paths. This study provides a new idea for e-commerce logistics distribution path optimization, which is of great significance for improving logistics efficiency and reducing operation cost.