How to fix constipation?

I'm 17 and female. During exams I wasn't able to poop normally either because of stress or from eating too little or too much food (mostly sweets and pasteries) and the only way for me to poop was through fibre packets. Exams are over and I still can't poop. How do I fix this? I would wait for 3 days for a poop and when it wouldn't work I'd take fibre packets. Whenever I try to poop without the packets it's physically exhausting and most of the time nothing comes out. I eat fruits and veggies everyday and would specifically eat pineapples and oranges everyday and nothing works. I tried eating yogurt but I'm lactose intolerant so its very painful for me. What should I do?