安装 python 的邮政(地址解析器)包时出现问题
Issue while installing Postal (Address Parser ) package of python
我正在尝试使用
安装邮政包裹
pip install postal
我正在按照 link 中提到的步骤进行操作
https://github.com/openvenues/libpostal#installation-windows
我已经安装了 Visual Studio 2019 C++ Build Tools、MSYS2 并执行了步骤
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 -j4
make install
我仍然无法使用 pip install postal
安装邮政包裹
安装邮政包裹时出现以下日志。
(base) C:\Users\Praveen>pip install postal
Collecting postal
Using cached https://files.pythonhosted.org/packages/56/f7/69ca5d374077e23aa9a51ecd4031222ca9dfb7d19c95d7691f024e2e27ef/postal-1.1.8.tar.gz
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from postal) (1.12.0)
Building wheels for collected packages: postal
Building wheel for postal (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"'; __file__='"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Praveen\AppData\Local\Temp\pip-wheel-e6vpt_0y' --python-tag cp37
cwd: C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\
Complete output (35 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\postal
copying postal\dedupe.py -> build\lib.win-amd64-3.7\postal
copying postal\expand.py -> build\lib.win-amd64-3.7\postal
copying postal\near_dupe.py -> build\lib.win-amd64-3.7\postal
copying postal\normalize.py -> build\lib.win-amd64-3.7\postal
copying postal\parser.py -> build\lib.win-amd64-3.7\postal
copying postal\tokenize.py -> build\lib.win-amd64-3.7\postal
copying postal\token_types.py -> build\lib.win-amd64-3.7\postal
copying postal\__init__.py -> build\lib.win-amd64-3.7\postal
creating build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_expand.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_parser.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\_test_near_dupes.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\__init__.py -> build\lib.win-amd64-3.7\postal\tests
creating build\lib.win-amd64-3.7\postal\utils
copying postal\utils\encoding.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\enum.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\omitted.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\__init__.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\pyutils.h -> build\lib.win-amd64-3.7\postal
running build_ext
building 'postal._expand' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\postal
C:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.7\Release\postal/pyexpand.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
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\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for postal
Running setup.py clean for postal
Failed to build postal
Installing collected packages: postal
Running setup.py install for postal ... error
ERROR: Command errored out with exit status 1:
command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"'; __file__='"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Praveen\AppData\Local\Temp\pip-record-k92kr5uk\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\
Complete output (35 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\postal
copying postal\dedupe.py -> build\lib.win-amd64-3.7\postal
copying postal\expand.py -> build\lib.win-amd64-3.7\postal
copying postal\near_dupe.py -> build\lib.win-amd64-3.7\postal
copying postal\normalize.py -> build\lib.win-amd64-3.7\postal
copying postal\parser.py -> build\lib.win-amd64-3.7\postal
copying postal\tokenize.py -> build\lib.win-amd64-3.7\postal
copying postal\token_types.py -> build\lib.win-amd64-3.7\postal
copying postal\__init__.py -> build\lib.win-amd64-3.7\postal
creating build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_expand.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_parser.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\_test_near_dupes.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\__init__.py -> build\lib.win-amd64-3.7\postal\tests
creating build\lib.win-amd64-3.7\postal\utils
copying postal\utils\encoding.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\enum.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\omitted.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\__init__.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\pyutils.h -> build\lib.win-amd64-3.7\postal
running build_ext
building 'postal._expand' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\postal
C:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.7\Release\postal/pyexpand.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
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\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"'; __file__='"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Praveen\AppData\Local\Temp\pip-record-k92kr5uk\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
尝试以下解决方案。我正在 运行WSL 中解决这个问题。
变化
- 在所有命令之前导航到 cd~ 目录。
- 制作前使用'sudo'。
cd~
git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure
sudo make
sudo make install
然后运行
pip install postal
还有 pip install nose
在导入和 运行 宁 postal 库之前。
大多数时候,libpostal 在 windows python 绑定中失败,所以我有一个新的 python 包,它捆绑了 libpostal 并使用 python 包, 可以使用。
这是名为 pypostalwin
的包裹
按照自述文件说明,享受使用来自 python
的 libpostal
我正在尝试使用
安装邮政包裹pip install postal
我正在按照 link 中提到的步骤进行操作 https://github.com/openvenues/libpostal#installation-windows
我已经安装了 Visual Studio 2019 C++ Build Tools、MSYS2 并执行了步骤
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 -j4
make install
我仍然无法使用 pip install postal
安装邮政包裹时出现以下日志。
(base) C:\Users\Praveen>pip install postal
Collecting postal
Using cached https://files.pythonhosted.org/packages/56/f7/69ca5d374077e23aa9a51ecd4031222ca9dfb7d19c95d7691f024e2e27ef/postal-1.1.8.tar.gz
Requirement already satisfied: six in c:\programdata\anaconda3\lib\site-packages (from postal) (1.12.0)
Building wheels for collected packages: postal
Building wheel for postal (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"'; __file__='"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d 'C:\Users\Praveen\AppData\Local\Temp\pip-wheel-e6vpt_0y' --python-tag cp37
cwd: C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\
Complete output (35 lines):
running bdist_wheel
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\postal
copying postal\dedupe.py -> build\lib.win-amd64-3.7\postal
copying postal\expand.py -> build\lib.win-amd64-3.7\postal
copying postal\near_dupe.py -> build\lib.win-amd64-3.7\postal
copying postal\normalize.py -> build\lib.win-amd64-3.7\postal
copying postal\parser.py -> build\lib.win-amd64-3.7\postal
copying postal\tokenize.py -> build\lib.win-amd64-3.7\postal
copying postal\token_types.py -> build\lib.win-amd64-3.7\postal
copying postal\__init__.py -> build\lib.win-amd64-3.7\postal
creating build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_expand.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_parser.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\_test_near_dupes.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\__init__.py -> build\lib.win-amd64-3.7\postal\tests
creating build\lib.win-amd64-3.7\postal\utils
copying postal\utils\encoding.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\enum.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\omitted.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\__init__.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\pyutils.h -> build\lib.win-amd64-3.7\postal
running build_ext
building 'postal._expand' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\postal
C:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.7\Release\postal/pyexpand.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
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\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Failed building wheel for postal
Running setup.py clean for postal
Failed to build postal
Installing collected packages: postal
Running setup.py install for postal ... error
ERROR: Command errored out with exit status 1:
command: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"'; __file__='"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Praveen\AppData\Local\Temp\pip-record-k92kr5uk\install-record.txt' --single-version-externally-managed --compile
cwd: C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\
Complete output (35 lines):
running install
running build
running build_py
creating build
creating build\lib.win-amd64-3.7
creating build\lib.win-amd64-3.7\postal
copying postal\dedupe.py -> build\lib.win-amd64-3.7\postal
copying postal\expand.py -> build\lib.win-amd64-3.7\postal
copying postal\near_dupe.py -> build\lib.win-amd64-3.7\postal
copying postal\normalize.py -> build\lib.win-amd64-3.7\postal
copying postal\parser.py -> build\lib.win-amd64-3.7\postal
copying postal\tokenize.py -> build\lib.win-amd64-3.7\postal
copying postal\token_types.py -> build\lib.win-amd64-3.7\postal
copying postal\__init__.py -> build\lib.win-amd64-3.7\postal
creating build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_expand.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\test_parser.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\_test_near_dupes.py -> build\lib.win-amd64-3.7\postal\tests
copying postal\tests\__init__.py -> build\lib.win-amd64-3.7\postal\tests
creating build\lib.win-amd64-3.7\postal\utils
copying postal\utils\encoding.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\enum.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\omitted.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\utils\__init__.py -> build\lib.win-amd64-3.7\postal\utils
copying postal\pyutils.h -> build\lib.win-amd64-3.7\postal
running build_ext
building 'postal._expand' extension
creating build\temp.win-amd64-3.7
creating build\temp.win-amd64-3.7\Release
creating build\temp.win-amd64-3.7\Release\postal
C:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -I/usr/local/include -IC:\ProgramData\Anaconda3\include -IC:\ProgramData\Anaconda3\include "-IC:\Program Files (x86)\Microsoft Visual Studio19\BuildTools\VC\Tools\MSVC.20.27508\include" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\include.0.17763.0\cppwinrt" /Tcpostal/pyexpand.c /Fobuild\temp.win-amd64-3.7\Release\postal/pyexpand.obj -std=c99
cl : Command line warning D9002 : ignoring unknown option '-std=c99'
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\BuildTools\VC\Tools\MSVC\14.20.27508\bin\HostX86\x64\cl.exe' failed with exit status 2
----------------------------------------
ERROR: Command errored out with exit status 1: 'C:\ProgramData\Anaconda3\python.exe' -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"'; __file__='"'"'C:\Users\Praveen\AppData\Local\Temp\pip-install-9sens8xe\postal\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:\Users\Praveen\AppData\Local\Temp\pip-record-k92kr5uk\install-record.txt' --single-version-externally-managed --compile Check the logs for full command output.
尝试以下解决方案。我正在 运行WSL 中解决这个问题。
变化
- 在所有命令之前导航到 cd~ 目录。
- 制作前使用'sudo'。
cd~
git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure
sudo make
sudo make install
然后运行
pip install postal
还有 pip install nose
在导入和 运行 宁 postal 库之前。
大多数时候,libpostal 在 windows python 绑定中失败,所以我有一个新的 python 包,它捆绑了 libpostal 并使用 python 包, 可以使用。
这是名为 pypostalwin
的包裹按照自述文件说明,享受使用来自 python
的 libpostal