使用meld或beyondcompare时出现cairo的错误: undefined symbol: cairo_tee_surface_index
程序员文章站
2022-04-19 16:37:18
...
之前在项目上构建文件系统时不知道什么操作把我主机的库cairo换了版本,导致我使用meld会出现以下错误:
$ meld
Traceback (most recent call last):
File "/usr/bin/meld", line 345, in <module>
import meld.meldapp
File "/usr/lib/python3/dist-packages/meld/meldapp.py", line 29, in <module>
import meld.ui.util
File "/usr/lib/python3/dist-packages/meld/ui/util.py", line 23, in <module>
from meld.ui import gladesupport
File "/usr/lib/python3/dist-packages/meld/ui/gladesupport.py", line 3, in <module>
from meld import diffmap
File "/usr/lib/python3/dist-packages/meld/diffmap.py", line 19, in <module>
import cairo
File "/usr/lib/python3/dist-packages/cairo/__init__.py", line 1, in <module>
from ._cairo import * # noqa: F401,F403
ImportError: /usr/lib/python3/dist-packages/cairo/_cairo.cpython-36m-x86_64-linux-gnu.so: undefined symbol: cairo_tee_surface_index
这是cairo库出了问题
我使用的是python3,重新安装一下吧:
$ pip3 install pycairo
Collecting pycairo
Downloading https://files.pythonhosted.org/packages/9d/6e/499d6a6db416eb3cdf0e57762a269908e4ab6638a75a90972afc34885b91/pycairo-1.20.0.tar.gz (344kB)
100% |████████████████████████████████| 348kB 224kB/s
Building wheels for collected packages: pycairo
Running setup.py bdist_wheel for pycairo ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-t3ilwsoc/pycairo/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/tmpny12g7j3pip-wheel- --python-tag cp36:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.6
creating build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
running build_ext
Requested 'cairo >= 1.15.10' but version of cairo is 1.14.10
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
----------------------------------------
Failed building wheel for pycairo
Running setup.py clean for pycairo
Failed to build pycairo
Installing collected packages: pycairo
Running setup.py install for pycairo ... error
Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-t3ilwsoc/pycairo/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-8igppu57-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-3.6
creating build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.py -> build/lib.linux-x86_64-3.6/cairo
copying cairo/__init__.pyi -> build/lib.linux-x86_64-3.6/cairo
copying cairo/py.typed -> build/lib.linux-x86_64-3.6/cairo
running build_ext
Requested 'cairo >= 1.15.10' but version of cairo is 1.14.10
Command '['pkg-config', '--print-errors', '--exists', 'cairo >= 1.15.10']' returned non-zero exit status 1.
----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-t3ilwsoc/pycairo/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-8igppu57-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-t3ilwsoc/pycairo/
以上说明版本太老了,那安装一个新的吧,就1.15.10
$ pip3 install pycairo==1.15.10
Collecting pycairo==1.15.10
Could not find a version that satisfies the requirement pycairo==1.15.10 (from versions: 1.11.0, 1.11.1, 1.12.0, 1.13.0, 1.13.1, 1.13.2, 1.13.3, 1.13.4, 1.14.0, 1.14.1, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 1.15.6, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.17.0, 1.17.1, 1.18.0, 1.18.1, 1.18.2, 1.19.0, 1.19.1, 1.20.0)
No matching distribution found for pycairo==1.15.10
没有这个版本可以安装,那就安装更新的最好:
$ pip3 install pycairo==1.16.1
Collecting pycairo==1.16.1
Downloading https://files.pythonhosted.org/packages/1f/8d/992c2c80c0fd56417029e886786cc1b40e6a55aba1c39f1418fad6f7c9aa/pycairo-1.16.1.tar.gz (180kB)
100% |████████████████████████████████| 184kB 369kB/s
Building wheels for collected packages: pycairo
Running setup.py bdist_wheel for pycairo ... done
Stored in directory: /home/sun/.cache/pip/wheels/6e/74/66/0e3ee5433d497d2655efd07aaec0548a39ef618d26d6db519f
Successfully built pycairo
Installing collected packages: pycairo
Successfully installed pycairo-1.16.1
成功了,meld可以正常使用了