我正在尝试在raspberry pi 3B中运行scikit-rf(https://scikit-rf-web.readthedocs.io/)提供的示例代码。我安装了所有必需的库,但我一直收到如下所示的错误。
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/matplotlib-2.2.0-py3.5-linux-armv7l.egg/matplotlib/backends/backend_cairo.py", line 24, in <module>
import cairocffi as cairo
ImportError: No module named 'cairocffi'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/matplotlib-2.2.0-py3.5-linux-armv7l.egg/matplotlib/backends/backend_cairo.py", line 27, in <module>
import cairo
ImportError: No module named 'cairo'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/pi/Desktop/Backup/scikit-rf-master/skrf/plotting.py", line 40, in <module>
import matplotlib.pyplot as plb
File "/usr/local/lib/python3.5/dist-packages/matplotlib-2.2.0-py3.5-linux-armv7l.egg/matplotlib/pyplot.py", line 115, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "/usr/local/lib/python3.5/dist-packages/matplotlib-2.2.0-py3.5-linux-armv7l.egg/matplotlib/backends/__init__.py", line 62, in pylab_setup
[backend_name], 0)
File "/usr/local/lib/python3.5/dist-packages/matplotlib-2.2.0-py3.5-linux-armv7l.egg/matplotlib/backends/backend_gtk3agg.py", line 10, in <module>
from .backend_cairo import cairo, HAS_CAIRO_CFFI
File "/usr/local/lib/python3.5/dist-packages/matplotlib-2.2.0-py3.5-linux-armv7l.egg/matplotlib/backends/backend_cairo.py", line 29, in <module>
raise ImportError("cairo backend requires that cairocffi or pycairo "
ImportError: cairo backend requires that cairocffi or pycairo is installed
我确实使用
安装了cairocffipip install cairocffi
输入pip freeze
会显示cairocff,但这似乎没什么帮助。道歉,因为我对python很新。
答案 0 :(得分:1)
您可能遇到不同Python版本的问题。
仔细检查Python版本,看看pip
是否安装在正确的位置。一旦我安装了Python 3和2,并且pip
在Python 2上安装了所有内容。我必须使用pip3
。