以下是我运行命令时看到的错误:
$ sudo apt-add-repository ppa:python-pylinkgrammar/getsome
Link Grammar source and libraries, as well as the python bindings that depend on them.
This is an "unsanctioned" release of the link-grammar libs, with a version bump to 4.7.6.
Hopefully, a "stable" PPA will be coming soon, and then on to the main repos.
More info: https://launchpad.net/~python-pylinkgrammar/+archive/ubuntu/getsome
Press [ENTER] to continue or ctrl-c to cancel adding it
gpg: keybox '/tmp/tmpamyb7e49/pubring.gpg' created
gpg: /tmp/tmpamyb7e49/trustdb.gpg: trustdb created
gpg: key 50E59F00E91F46F4: public key "Launchpad PPA for Linkgrammar for Python" imported
gpg: Total number processed: 1
gpg: imported: 1
OK
$ sudo apt-get install liblink-grammar4
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package liblink-grammar4
**max@max-Latitude-E6410:~$** pip install pylinkgrammar
Collecting pylinkgrammar
Using cached pylinkgrammar-0.2.14.tar.gz
Building wheels for collected packages: pylinkgrammar
Running setup.py bdist_wheel for pylinkgrammar ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-5WPIa0/pylinkgrammar/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 /tmp/tmpk2yg0rpip-wheel- --python-tag cp27:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/tests.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/__init__.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/clinkgrammar.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/linkgrammar.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
running build_ext
building 'pylinkgrammar/_clinkgrammar' extension
swigging pylinkgrammar/link_grammar.i to pylinkgrammar/link_grammar_wrap.c
swig -python -o pylinkgrammar/link_grammar_wrap.c pylinkgrammar/link_grammar.i
unable to execute 'swig': No such file or directory
error: command 'swig' failed with exit status 1
----------------------------------------
Failed building wheel for pylinkgrammar
Running setup.py clean for pylinkgrammar
Failed to build pylinkgrammar
Installing collected packages: pylinkgrammar
Running setup.py install for pylinkgrammar ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-5WPIa0/pylinkgrammar/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vu3zyF-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/tests.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/__init__.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/clinkgrammar.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
copying pylinkgrammar/linkgrammar.py -> build/lib.linux-x86_64-2.7/pylinkgrammar
running build_ext
building 'pylinkgrammar/_clinkgrammar' extension
swigging pylinkgrammar/link_grammar.i to pylinkgrammar/link_grammar_wrap.c
swig -python -o pylinkgrammar/link_grammar_wrap.c pylinkgrammar/link_grammar.i
unable to execute 'swig': No such file or directory
error: command 'swig' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-5WPIa0/pylinkgrammar/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vu3zyF-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-5WPIa0/pylinkgrammar/
答案1
您所遵循的说明似乎是针对 Ubuntu 的旧版本编写的。这让我们没有多少选择。
选项1)尝试使用所需软件包的当前可用版本进行安装。这种方法在本文编辑之日起失效,原因是liblink-grammar5-dev
当前不可用且是必需的。
安装liblink-grammar-dev
也无济于事,而且也失败了。
参见选项 2:
看起来像liblink-grammar4不适用于 17.04 (Zesty)。
在较新版本的 Ubuntu 中,它似乎已被替换为liblink-grammer5。通常依赖项要求版本等于或高于特定版本,因此较新的版本应该可以工作。
为了安装它,你需要先启用 Universe 存储库。
然后发出命令sudo apt install liblink-grammer5
如果你(像我一样)收到如下错误:
未找到文件 us.archive.ubuntu.com_ubuntu_dists_zesty-updates_main_dep11_Components-amd64.yml.gz 的来源
那么你很可能受到这个错误或类似的东西。我使用命令解决了这个问题appstreamcli refresh --force
如果仍然出现无法找到包的错误,你可以直接从这里然后通过 gdebi 安装它,sudo gdebi PackageName
或者在我的情况下sudo gdebi liblink-grammar5_5.3.14-1_amd64.deb
您的输出还包含一个定位包的错误痛饮。由于我们已经启用了 universe 存储库以获取 liblink-grammer5,因此我们只需发出命令sudo apt install swig
即可获取该包。既然您已经解决了看似依赖的问题,那么您应该能够成功pip install pylinkgrammar
选项 2)
双启动或虚拟化 16.04 并在仍然提供 liblink-grammer4 和 liblink-grammer4-dev 的 Ubuntu 版本上安装和运行 pylinkgrammer。
我希望这两种方法在 liblink-grammar5-dev 发布 17.04 后都能起作用,但目前(由于尚未发生,因此选项 2 是您的最佳选择。
答案2
这是包含该问题解决方案的链接。运行 Ubuntu 的 Python 用户将运行这些命令。Pylinkgrammar 上的软件包严重过时。因此,必须下载链接语法的 tar bell 文件并自行构建。
Link Grammar 5.4 有新版本了。在 Abiword 获取 tar 文件: 在 Abiword 下载
链接命令构建链接语法 *请参阅“创建系统部分”