Installing matplotlib into Ubuntu 18.04
内容导读
互联网集市收集整理的这篇技术教程文章主要介绍了Installing matplotlib into Ubuntu 18.04,小编现在分享给大家,供广大互联网技能从业者学习和参考。文章包含3656字,纯文字阅读大概需要6分钟。
内容图文
![Installing matplotlib into Ubuntu 18.04](/upload/InfoBanner/zyjiaocheng/928/530b47179fed4baba8fbe07ecccb7e20.jpg)
File "/home/lee/share/py_lab/matplotlib_animation/src/test001.py", line 2, in <module>
from matplotlib import animation,pyplot
File "/home/lee/share/py_lab/env001_matplot_animate/lib/python3.8/site-packages/matplotlib/pyplot.py", line 36, in <module>
import matplotlib.colorbar
File "/home/lee/share/py_lab/env001_matplot_animate/lib/python3.8/site-packages/matplotlib/colorbar.py", line 44, in <module>
import matplotlib.contour as contour
File "/home/lee/share/py_lab/env001_matplot_animate/lib/python3.8/site-packages/matplotlib/contour.py", line 17, in <module>
import matplotlib.text as text
File "/home/lee/share/py_lab/env001_matplot_animate/lib/python3.8/site-packages/matplotlib/text.py", line 16, in <module>
from .textpath import TextPath # Unused, but imported by others.
File "/home/lee/share/py_lab/env001_matplot_animate/lib/python3.8/site-packages/matplotlib/textpath.py", line 11, in <module>
from matplotlib.mathtext import MathTextParser
File "/home/lee/share/py_lab/env001_matplot_animate/lib/python3.8/site-packages/matplotlib/mathtext.py", line 27, in <module>
from PIL import Image
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 68, in <module>
from PIL import _imaging as core
ImportError: cannot import name '_imaging' from 'PIL' (/usr/lib/python3/dist-packages/PIL/__init__.py)
python imports matplotlib from virtual env
PIL from system python path
which leads to version conflict
run sudo pip uninstall pillow in system shell
then pip install pillow in virtual env
helloword
/home/lee/share/py_lab/matplotlib_animation/src/test001.py:19: UserWarning: Matplotlib is currently using agg, which is a non-GUI backend, so cannot show the figure.
pyplot.show()
It means we need a new GUI backend
import matplotlib.rcsetup as rcsetup
print(rcsetup.all_backends)
['GTK3Agg', 'GTK3Cairo', 'MacOSX', 'nbAgg', 'Qt4Agg', 'Qt4Cairo', 'Qt5Agg', 'Qt5Cairo', 'TkAgg', 'TkCairo', 'WebAgg', 'WX', 'WXAgg', 'WXCairo', 'agg', 'cairo', 'pdf', 'pgf', 'ps', 'svg', 'template']
try:
matplotlib.use('QT5Agg')
then:
File "/home/lee/share/py_lab/env002_matplot_animate/lib/python3.8/site-packages/matplotlib/pyplot.py", line 277, in backend_mod
locals().update(vars(importlib.import_module(backend_name)))
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "/home/lee/share/py_lab/env002_matplot_animate/lib/python3.8/site-packages/matplotlib/backends/backend_qt5agg.py", line 11, in <module>
from .backend_qt5 import (
File "/home/lee/share/py_lab/env002_matplot_animate/lib/python3.8/site-packages/matplotlib/backends/backend_qt5.py", line 16, in <module>
import matplotlib.backends.qt_editor.figureoptions as figureoptions
File "/home/lee/share/py_lab/env002_matplot_animate/lib/python3.8/site-packages/matplotlib/backends/qt_editor/figureoptions.py", line 11, in <module>
from matplotlib.backends.qt_compat import QtGui
File "/home/lee/share/py_lab/env002_matplot_animate/lib/python3.8/site-packages/matplotlib/backends/qt_compat.py", line 177, in <module>
raise ImportError("Failed to import any qt binding")
ImportError: Failed to import any qt binding
try:
pip3 install pyqt5
then:
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb.
Aborted (core dumped)
try:
sudo apt-get install libxcb-xinerama0
then:
内容总结
以上是互联网集市为您收集整理的Installing matplotlib into Ubuntu 18.04全部内容,希望文章能够帮你解决Installing matplotlib into Ubuntu 18.04所遇到的程序开发问题。 如果觉得互联网集市技术教程内容还不错,欢迎将互联网集市网站推荐给程序员好友。
内容备注
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 gblab@vip.qq.com 举报,一经查实,本站将立刻删除。
内容手机端
扫描二维码推送至手机访问。