Aims. We study the link between gravitational slopes and the surface morphology on the nucleus of comet 67P/Churyumov-Gerasimenko and provide constraints on the mechanical properties of the cometary material (tensile, shear, and compressive strengths). Methods. We computed the gravitational slopes for five regions on the nucleus that are representative of the different morphologies observed on the surface (Imhotep, Ash, Seth, Hathor, and Agilkia), using two shape models computed from OSIRIS images by the stereo-photoclinometry (SPC) and stereo-photogrammetry (SPG) techniques. We estimated the tensile, shear, and compressive strengths using different surface morphologies (overhangs, collapsed structures, boulders, cliffs, and Philae's footprint) and mechanical considerations. The strength-to-gravity ratio is similar for 67P and weak rocks on Earth. As a result of the low compressive strength, the interior of the nucleus may have been compressed sufficiently to initiate diagenesis, which could have contributed to the formation of layers. Our value for the tensile strength is comparable to that of dust aggregates formed by gravitational instability and tends to favor a formation of comets by the accrection of pebbles at low velocities.