This script automatically installs the Python hunspell package on Windows by setting up the necessary environment.
- Checks for and installs vcpkg if not present
- Installs hunspell C++ library using vcpkg
- Creates a virtual drive and directory structure expected by the hunspell Python package
- Copies required header and library files to the expected locations
- Installs the Python hunspell package
- Copies the necessary DLL to Python's DLLs directory for runtime loading
- Cleans up the virtual drive mapping
- Windows OS
- Python (tested with Python 3.6+)
- Administrative privileges (for virtual drive creation)
- Internet connection
- Microsoft Visual C++ Build Tools
- Save the script as
install-hunspell-windows.cmd
- Run the script as administrator
- Wait for the installation to complete
If you encounter issues, check that:
- You're running the script as administrator
- Visual Studio Build Tools are installed
- No other process is using drive V:
You can use hunspell in your Python code:
import hunspell
h = hunspell.Hunspell()
print(h.spell("correct")) # True
print(h.spell("incorrekt")) # False
suggestions = h.suggest("incorrekt")
print(suggestions) # ['incorrect', ...]