Windows create symbolic links

Windows users may not have permission to create a symbolic link by default. Symptoms from Python may result:

from pathlib import Path

Path('x').symlink_to('y')

OSError: symbolic link privilege not held

Fix by enabling Windows symbolic links by enabling Windows developer mode.

Restart computer, and once again try Python script above to see that Python can create symbolic links.

Group Policy: press Windows r key (run dialog) and type

gpedit.msc

If gpedit.msc is not available, use Python ≥ 3.8 with Windows in Developer Mode as above.


Navigate to create user permission to create symbolic links:

Computer Configuration → Windows Settings → Security Settings → Local Policies → User Rights Assignment → Create symbolic links

type the user name and click “Check Names” then OK.

Reboot the computer (or logoff, logon) to make the permissions take effect.

Reference: Python os.symlink() on Windows generally requires Python ≥ 3.8

Related: symbolic links on Windows