How do I focus from the distraction of people who look attractive?
Since you are philosophical, ponder: "What is beauty? Why does it exist? What is its purpose?" 

In Buddhism, five questions are always asked about a thing:

(1) How does the thing arise (samudaya)? 

(2) How does the thing pass (atthaṅgama)? 

(3) What is the attraction (assāda) of the thing?

(4) What is the drawback or danger (ādīnava) of the thing? 

(5) What is the method to escape (nissaraṇa) the danger? (which may include, with some things, escaping the danger while utilizing the attractive quality.) 


  Bhikkhus, the uninstructed worldling does not understand as it really is the origin and the passing away, the gratification, the danger and
  the escape in the case of form, feeling, perception, volitional
  formations and consciousness.
  
  But, bhikkhus, the instructed noble disciple understands as it really is the origin and the passing away, the gratification, the danger and
  the escape in the case of form, feeling, perception, volitional
  formations and consciousness.
  
  SN 22.74