Looking at PISA data:
Even in countries where women’s liberties are severely restricted, we found that girls are outperforming boys in reading, mathematics, and science literacy by age 15, regardless of political, economic, social, or gender-equality issues and policies […].
And on a side note:
Some schools have found that it is, in fact, how classes are taught that encourage or discourage more women in the sciences. The University of California, Berkeley, tried an intro to computer science class that is more collaborative and problem-based, and it achieved a majority of women for the first time.
What remains unclear is as to why those women then don’t choose related career paths. The paper is sadly behind a paywall (Elsevier).