Windows users may not have permission to create a symbolic link by default. This can result in errors from Python like:
from pathlib import Path Path('x').touch() Path('x').symlink_to('y')
import os os.symlink('x', 'y')
OSError: symbolic link privilege not held
Put Windows into Developer Mode: Settings → Updates & Security → For Developers → Use developer features: Select “Developer mode”
Restart computer, and once again try Python script above to see that Python can create symbolic links.
If it’s still not possible to create symbolic links, you may simply need to use Python ≥ 3.8.
If your version of Windows has it, press Windows + R key (run dialog) and type
If you don’t have this, you will need to 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.
- Python os.symlink() on Windows generally requires Python ≥ 3.8