A method for compensating a phase deviation in an optical transmission, which is applied to a data sequence between a first training sequence and a second training sequence which are received by a receiving end, comprising: determining a first phase difference between the first training sequence and a standard training sequence used for reference, and a second phase difference between the second training sequence and the standard training sequence; determining a subdata sequence requiring a phase compensation in multiple subdata sequences forming the data sequence according to the first phase difference and the second phase difference; calculating a phase compensation value corresponding to the subdata sequence requiring the phase compensation by using the first phase difference and the second phase difference; and conducting the phase compensation on the subdata sequence requiring the phase compensation by using the phase compensation value corresponding to the subdata sequence; characterized in that the step of determining whether multiple subdata sequences forming the data sequence require the phase compensation according to the first phase difference and the second phase difference specifically comprises: if the first phase difference is less than a first threshold and the second phase difference subtracted by the first phase difference is greater than a second threshold, then determining that only subdata sequences located in latter half of the data sequence require the phase compensation; and if the first phase difference is greater than the first threshold, then determining that all the subdata sequences of the data sequence require the phase compensation. determining a first phase difference between the first training sequence and a standard training sequence used for reference, and a second phase difference between the second training sequence and the standard training sequence; determining a subdata sequence requiring a phase compensation in multiple subdata sequences forming the data sequence according to the first phase difference and the second phase difference; calculating a phase compensation value corresponding to the subdata sequence requiring the phase compensation by using the first phase difference and the second phase difference; and conducting the phase compensation on the subdata sequence requiring the phase compensation by using the phase compensation value corresponding to the subdata sequence; characterized in that the step of determining whether multiple subdata sequences forming the data sequence require the phase compensation according to the first phase difference and the second phase difference specifically comprises: if the first phase difference is less than a first threshold and the second phase difference subtracted by the first phase difference is greater than a second threshold, then determining that only subdata sequences located in latter half of the data sequence require the phase compensation; and if the first phase difference is greater than the first threshold, then determining that all the subdata sequences of the data sequence require the phase compensation. if the first phase difference is less than a first threshold and the second phase difference subtracted by the first phase difference is greater than a second threshold, then determining that only subdata sequences located in latter half of the data sequence require the phase compensation; and if the first phase difference is greater than the first threshold, then determining that all the subdata sequences of the data sequence require the phase compensation.