我无法在Windows上安装libpostal库

2024-10-02 04:18:26 发布

您现在位置:Python中文网/ 问答频道 /正文

我很难在Windows系统上安装libpostal库。 我曾多次尝试在其他计算机上安装此库,但均未成功

我遵循了不同的指示:https://github.com/openvenues/libpostal 或者https://github.com/openvenues/pypostal/pull/39/files没有任何效果

<> >,我安装了VisualStudio 2019 C++生成工具Mys2,并执行了代码:

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)不在目录中,但即使我手动复制它,安装仍然无法工作

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

你太好了。 多谢各位


Tags: installbuildincludewindowsfilesprogramx86microsoft
1条回答
网友
1楼 · 发布于 2024-10-02 04:18:26

我也面临着同样的问题,如果我没记错的话,这就足够了:

export LD_LIBRARY_PATH=your_path_to_the_lib

就你的情况而言,它是/c

我用的是WSL,所以我不知道对你来说是否也一样, 但是我可以向您保证,问题来自于python在错误的文件夹中查找lib的头文件这一事实

您可以按照此link了解有关windows上lib的更多信息

相关问题 更多 >

    热门问题