Wearing glasses does not stop you from getting a Class 2 Medical Certificate which is required for private pilot license (PPL) student pilot license (SPL) and other initial aviation training stages. The medical authority mainly checks whether your vision can be corrected to the required standard. If your eyesight can be brought within normal limits with the help of spectacles or contact lenses, you are generally considered fit. Only severe cases like uncontrolled eye diseases major color blindness or uncorrectable vision loss may cause disqualification.
During the medical test doctors will examine your visual acuity, eye health, and color perception. If you need glasses the medical certificate will note that you must always wear corrective lenses while flying. Many professional pilots around the world wear glasses or contacts, and it is accepted practice in aviation. Therefore, as long as your eyes are otherwise healthy glasses will not stop you from pursuing your flying career.