简体   繁体   中英

ImportError: No module named 'cairocffi'

I am trying to run a sample code provided by scikit-rf ( https://scikit-rf-web.readthedocs.io/ ) in a raspberry pi 3B. I installed all required libraries but I keep getting the error shown below.

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

I did install cairocffi using

pip install cairocffi

Entering pip freeze shows cairocff but this doesn't seem to help. Apologies as I am quite new to python.

You might be having trouble with different Python versions. Double check Python versions and see if pip is installing in the right locations. Once I had Python 3 and 2 installed, and pip was installing everything on Python 2. I had to use pip3 for that.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM