我正在尝试在Python中使用视觉上如此吸引人的成分树库:https://github.com/Halvani/Constituent-Treelib。我已按照安装步骤(pip install,...)进行操作,但出现此错误:
Collecting constituent-treelib
Downloading constituent_treelib-0.0.6-py3-none-any.whl.metadata (17 kB)
Requirement already satisfied: benepar in
c:\users\... \python311\lib\site-packages (from constituent-
treelib) (0.2.0)
Collecting contractions (from constituent-treelib)
Downloading contractions-0.1.73-py2.py3-none-any.whl.metadata (1.2 kB)
Collecting fasttext (from constituent-treelib)
Using cached fasttext-0.9.2.tar.gz (68 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> [28 lines of output]
C:\Users\...\Python311\python.exe: No module named pip
Traceback (most recent call last):
File "<string>", line 38, in __init__
ModuleNotFoundError: No module named 'pybind11'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\...\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
main()
File "C:\Users\...\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\...\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\...\AppData\Local\Temp\pip-build-env-8f9djh2i\overlay\Lib\site-packages\setuptools\build_meta.py", line 325, in get_requires_for_build_wheel
return self._get_build_requires(config_settings, requirements=['wheel'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\...\AppData\Local\Temp\pip-build-env-8f9djh2i\overlay\Lib\site-packages\setuptools\build_meta.py", line 295, in _get_build_requires
self.run_setup()
File "C:\Users\...\AppData\Local\Temp\pip-build-env-8f9djh2i\overlay\Lib\site-packages\setuptools\build_meta.py", line 487, in run_setup
super().run_setup(setup_script=setup_script)
File "C:\Users\...\AppData\Local\Temp\pip-build-env-8f9djh2i\overlay\Lib\site-packages\setuptools\build_meta.py", line 311, in run_setup
exec(code, locals())
File "<string>", line 72, in <module>
File "<string>", line 41, in __init__
RuntimeError: pybind11 install failed.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.
有人知道如何解决这个问题吗?非常感谢。
我是Constituent-Treelib的创建者。感谢您指出这个错误!
造成这种情况的原因是底层语言检测器 fasttext (自 2024 年 3 月起在 Github 上存档)造成的,它负责选择相应的 spaCy 和 benepar 模型以正确解析句子。由于这个错误,我用 langid 替换了 fasttext 并对其进行了广泛的测试。您可以在此处找到新版本。
祝解析愉快,祝您有美好的一天!或者在 Constituent-Treelib 的上下文中...
别忘了star该项目😉