Based on virtual simulation technology, a virtual simulation experiment system of soil mechanical properties under complex environment is developed. The system can realize the repeated dry wet cycle and freeze-thaw cycle of soil samples through the virtual simulation experiment device. The influence of hot summer and rainy, heat and cold on the mechanical properties of soil can be simulated. The consolidation, direct shear and triaxial tests are carried out to test the strength and deformation characteristics of soil samples under complex environment. The operation process of virtual test was similar to that of real test. The interactive feeling was lifelike. Students can intuitively experience the process of environmental simulation and mechanical test of soil samples and overcome the difficulties of hard realization, high cost and limited by time and space. Students could understand the effect of complex environment on soil mechanical properties in limited classroom teaching time.