【问题标题】:I can't install libpostal library on Windows我无法在 Windows 上安装 libpostal 库
【发布时间】:2021-08-10 08:32:06
【问题描述】:

我很难在 Windows 系统上安装库 libpostal。 即使在另一台计算机上,我也尝试了很多次安装这个库,但我没有成功。

我已按照不同的说明进行操作:https://github.com/openvenues/libpostalhttps://github.com/openvenues/pypostal/pull/39/files 没有任何效果。

所以,我已经安装了 Visual Studio 2019 C++ Build Tools、MSYS2 并执行了代码:

pacman -Syu
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=/c
make -j4
make install

我也试过不同的版本:

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=/c
make
make install
mkdir headers && cp -r /usr/include/libpostal/ headers/

然后我已经执行了安装库的命令:

现在启动一个可以访问 Microsoft 工具链的命令提示符。这可以通过例如安装Windows 10 SDK,然后运行x64 Native Tools Command Prompt

    C:\msys64\home\eric\libpostal>lib.exe /def:libpostal.def /out:postal.lib /machine:x64
Microsoft (R) Library Manager Version 14.29.30040.0
Copyright (C) Microsoft Corporation.  All rights reserved.

   Creating postal.lib and postal.exp

C:\msys64\home\eric\libpostal>cd C:\Python\Python38\Scripts

C:\Python\Python38\Scripts>pip install postal --global-option=build_ext --global-option="-IC:\msys64\home\eric\libpostal\headers" --global-option="-LC:\msys64\home\eric\libpostal"
c:\python\python38\lib\site-packages\pip\_internal\commands\install.py:229: UserWarning: Disabling all use of wheels due to the use of --build-option / --global-option / --install-option.
  cmdoptions.check_install_build_global(options)
Collecting postal
  Using cached postal-1.1.9.tar.gz (19 kB)
Requirement already satisfied: six in c:\python\python38\lib\site-packages (from postal) (1.15.0)
Skipping wheel build for postal, due to binaries being disabled for it.
Installing collected packages: postal
    Running setup.py install for postal ... error
    ERROR: Command errored out with exit status 1:
     command: 'c:\python\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"'; __file__='"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\msys64\home\eric\libpostal\headers' '-LC:\msys64\home\eric\libpostal' install --record 'C:\Users\eric\AppData\Local\Temp\pip-record-604ht5ta\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\python38\Include\postal'
         cwd: C:\Users\eric\AppData\Local\Temp\pip-install-lq_05aia\postal_a89efdf6d28d45bf8f9cd4f29a72d366\
    Complete output (12 lines):
    WARNING: The wheel package is not available.
    running build_ext
    building 'postal._expand' extension
    creating build
    creating build\temp.win-amd64-3.8
    creating build\temp.win-amd64-3.8\Release
    creating build\temp.win-amd64-3.8\Release\postal
    C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\msys64\home\eric\libpostal\headers -Ic:\python\python38\include -Ic:\python\python38\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.29.30037\include" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.19041.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.8\Release\postal/pyexpand.obj -std=c99
    clÿ: Ligne de commande warning D9002ÿ: option '-std=c99' ignoring unknown
    pyexpand.c
    postal/pyexpand.c(2): fatal error C1083: Cannot open include file: 'libpostal/libpostal.h': No such file or directory
    error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Tools\\MSVC\\14.29.30037\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2
    ----------------------------------------
ERROR: Command errored out with exit status 1: 'c:\python\python38\python.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"'; __file__='"'"'C:\\Users\\eric\\AppData\\Local\\Temp\\pip-install-lq_05aia\\postal_a89efdf6d28d45bf8f9cd4f29a72d366\\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' build_ext '-IC:\msys64\home\eric\libpostal\headers' '-LC:\msys64\home\eric\libpostal' install --record 'C:\Users\eric\AppData\Local\Temp\pip-record-604ht5ta\install-record.txt' --single-version-externally-managed --compile --install-headers 'c:\python\python38\Include\postal' Check the logs for full command output.

如您所见,安装失败。该文件 (libpostal.h) 不在目录中,但即使我手动复制它,安装仍然无法正常工作。

如果你能帮我安装这个库,因为我已经尝试安装这个库好几天了。

你会非常好。 谢谢。

【问题讨论】:

    标签: python windows visual-c++ command-line street-address


    【解决方案1】:

    我遇到了同样的问题,如果我没记错的话就足够了:

    export LD_LIBRARY_PATH=your_path_to_the_lib

    在你的情况下是 /c

    我使用的是 WSL,所以我不知道它是否适合您, 但我可以向你保证,问题出在 python 在错误文件夹中查找 lib 的头文件这一事实。

    您可以关注link 以获取有关 windows 上 lib 的更多信息

    【讨论】:

    • 感谢您的回复。如果您成功安装此库,请提供更多详细信息。我应该在哪里运行这个命令以及我需要修改什么?谢谢 bcp。
    【解决方案2】:

    我有一个新的python包,捆绑了libpostal,使用python包,可以使用。

    这是一个名为pypostalwin的包

    按照自述文件的说明,享受从 python 中使用 libpostal 的乐趣

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-06-19
      • 1970-01-01
      • 1970-01-01
      • 2019-02-07
      • 1970-01-01
      • 2014-01-23
      • 2020-02-17
      相关资源
      最近更新 更多