The invention provides a compressor and an air conditioner. The compressor comprises a rotating shaft and an air cylinder. The rotating shaft penetrates through the air cylinder, the rotating shaft issleeved with a first flange, a second flange and a roller, the roller is located in the air cylinder, the first flange is arranged at the first end of the air cylinder in a covering manner, the second flange is arranged on the second end of the air cylinder in a covering manner, the roller is limited inside through the air cylinder, the first flange and the second flange, the roller is provided with a first limiting part, a crankshaft is provided with a second limiting part, the first limiting part and the second limiting part are matched, and a rotating shaft and the roller are fixed in theaxis direction of the rotating shaft. According to the compressor, moving of the crankshaft during work in the axial direction can be reduced, the compressor can more stably work, friction between parts can be reduced, and meanwhile, noise generated during work of the compressor can be reduced.