**Installing libpostal on Windows**
Install [msys2](
http://msys2.org) and launch a shell using the `MSYS2 MingW 64-bit` start menu option, **not** the usual `MSYS2 MSYS` option.
This is important because we don't want our `libpostal.dll` to [link to](
https://www.davidegrayson.com/windev/msys2/) `msys-2.0.dll` (Python seems to hang if you load this DLL).
Then:
```
pacman -S autoconf automake curl git make libtool gcc mingw-w64-x86_64-gcc
git clone
https://github.com/openvenues/libpostal
cd libpostal
cp -rf windows/* ./
./bootstrap.sh
./configure --datadir=[...some dir with a few GB of space...]
make
make install
mkdir headers && cp -r /usr/include/libpostal/ headers/
```
Modify libpostal.def like that (libpostal.def is in the folder of libpostal) :
EXPORTS
libpostal_address_parser_response_destroy
libpostal_expand_address
libpostal_expand_address_root
libpostal_expansion_array_destroy
libpostal_get_address_parser_default_options
libpostal_get_default_duplicate_options
libpostal_get_default_fuzzy_duplicate_options
libpostal_get_default_fuzzy_duplicate_options_with_languages
libpostal_get_default_options
libpostal_get_duplicate_options_with_languages
libpostal_get_near_dupe_hash_default_options
libpostal_is_floor_duplicate
libpostal_is_house_number_duplicate
libpostal_is_name_duplicate
libpostal_is_name_duplicate_fuzzy
libpostal_is_po_box_duplicate
libpostal_is_postal_code_duplicate
libpostal_is_street_duplicate
libpostal_is_street_duplicate_fuzzy
libpostal_is_toponym_duplicate
libpostal_is_unit_duplicate
libpostal_near_dupe_hashes
libpostal_near_dupe_hashes_languages
libpostal_normalize_string
libpostal_normalize_string_languages
libpostal_normalized_tokens
libpostal_normalized_tokens_languages
libpostal_parse_address
libpostal_parser_print_features
libpostal_place_languages
libpostal_setup
libpostal_setup_datadir
libpostal_setup_language_classifier
libpostal_setup_language_classifier_datadir
libpostal_setup_parser
libpostal_setup_parser_datadir
libpostal_teardown
libpostal_teardown_language_classifier
libpostal_teardown_parser
libpostal_tokenize
Now start a command prompt which has access to the Microsoft toolchain. This can be done by e.g. installing the [Windows 10 SDK](
https://developer.microsoft.com/en-u...windows-10-sdk) and then running the ``x64 Native Tools Command Prompt``.
Assuming your MSYS and Python are installed in some standard locations, you can use this command prompt to build+install the Python library like so:
```
lib.exe /def:libpostal.def /out:postal.lib /machine

64 (libpostal.def is in the folder of libpostal)
(ex: D:\Dev\msys64\home\user\libpostal>lib.exe /def:libpostal.def /out:postal.lib /machine

64)
pip install postal --global-option=build_ext --global-option="-I[...libpostal checkout...]\headers" --global-option="-L[...libpostal checkout...]"
D:\Dev\msys64\home\user\libpostal>copy src\.libs\libpostal-1.dll D:\Dev\Python\eric_env\Lib\site-packages\postal\libpostal.dll
Partager