I alternated. Several days or nights per week at Starbucks with a couple of friends. Noise cancelling head phones are a must. +++ when you befriend the baristas and they start hooking you up because you basically live there.
Then I would do some days at home, alone, studying with frequent breaks to go to the gym, do laundry, walk the dogs, etc. I used a variation of the pomodoro method and took longer breaks when my brain felt fried.
I think the most important thing is finding a place that works for you where you feel productive. Some days I needed to be around my friends just for the company and laughs. Other days I was more focused and productive doing solo study.
Good luck!