No, but: cast Shadow Blade; never draw your sword; or fight without proficiency
Generally it is just lineage, class or feats that "grant you proficiency with certain weapons or categories of weapons" according to the Player's Handbook.
Cast Shadow Blade
As a Wizard you can be proficient when using a (specific solidified gloom) sword from level 3 onwards by casting Shadow Blade, as it "counts as a simple melee weapon with which you are proficient".
Your DM might let you train
While there are rules for training "a new language" or "a set of tools", there is no specific rule for training a weapon proficiency. The Player's Handbook says "Your DM might allow additional training options". It would be 250 days downtime and 1 gp/day by those rules.
When creating a new character
If you are creating a new character, the Customizing Your Origin rules from Tasha's Cauldron of Everything lets you do "proficiency swaps" in your initial lineage, where you can swap a Martial Weapon or Armor proficiency for a Martial Weapon proficiency you want. This includes most Elves, most Dwarves, and options from Monsters of the Multiverse include Eladrin, Giff, Githyanki and Shadar-Kai. You can get weapon proficiency through a feat like Weapon Master that you can pick with Custom Lineage or Variant Human, but that feels like overkill.
Some magic items
As NathanS notes, only a couple of magic items grant proficiency, for example while attuned to the Snicker-Snack from Wild Beyond the Witchlight "you have proficiency with greatswords".
High level spells
At higher levels spells like Tenser's Transformation would do it.
Never draw your sword
My favourite work around would be to never take your sword out of it's scabbard when fighting (a very Zatoichi image in my mind), and use it like the quarterstaff you are already proficient with because "At the DM's option, a character proficient with a weapon can use a similar object as if it were that weapon and use his or her proficiency bonus".
Disguise your quarterstaff
Similarly, you could cast Disguise Self to make your quarterstaff look like a sword since you can "make yourself—including your … weapons" look different.
Fight without proficiency
Finally, you can always use a sword without being proficient, you just don't get to add your proficiency bonus. You could partially compensate for this by casting Magic Weapon (for a +1 bonus).