[英]pyplot import raises ImportError
I am having a strange problem tryin to import matplotlib. 我有一个奇怪的问题,试着导入matplotlib。 Whenever I do the import 每当我进行导入
import matplotlib.pyplot as plt 将matplotlib.pyplot导入为plt
I get the following error message (When just importing matplotlib there is no error: 我收到以下错误消息(当导入matplotlib时没有错误:
Vendor: Continuum Analytics, Inc.
Package: mkl
Message: trial mode expires in 30 days
Traceback (most recent call last):
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 159, in <module>
from PySide import QtCore, QtGui, __version__, __version_info__
ImportError: No module named 'PySide'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:/Users/Pierre/Dropbox/piR/Coding/Python/Eigene Projekte/GPX_reader/main.py", line 6, in <module>
import matplotlib.pyplot as plt
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\pyplot.py", line 114, in <module>
_backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\__init__.py", line 32, in pylab_setup
globals(),locals(),[backend_name],0)
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt4agg.py", line 18, in <module>
from .backend_qt5agg import FigureCanvasQTAggBase as _FigureCanvasQTAggBase
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5agg.py", line 15, in <module>
from .backend_qt5 import QtCore
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\backend_qt5.py", line 31, in <module>
from .qt_compat import QtCore, QtGui, QtWidgets, _getSaveFileName, __version__
File "C:\Users\Pierre\Anaconda3\lib\site-packages\matplotlib\backends\qt_compat.py", line 162, in <module>
"Matplotlib qt-based backends require an external PyQt4, PyQt5,\n"
ImportError: Matplotlib qt-based backends require an external PyQt4, PyQt5,
or PySide package to be installed, but it was not found.
I use Python 3.5 in the Anaconda distribution on Windows 10. Anybody run into the same problem? 我在Windows 10上的Anaconda发行版中使用Python 3.5。任何人遇到同样的问题? The only recent change in the my setup was the (forced) upgrade to Windows 10... 我的设置中最近唯一的变化是(强制)升级到Windows 10 ...
Thanks and best wishes 谢谢,并祝福
Pierre 皮埃尔
You don't have PySide
or PyQt
installed, the Error Message is clear about that as matplotlib depends on either one of them 您没有安装PySide
或PyQt
,错误消息很清楚,因为matplotlib依赖于其中任何一个
To install PySide run 安装PySide运行
pip install -U PySide
from the command line the -U stands for upgrade and means upgrade all packages you have installed to the newest version 从命令行开始,-U代表升级,意味着将已安装的所有软件包升级到最新版本
from the man page of pip 来自pip的手册页
-U, --upgrade
Upgrade all packages to the newest available version. This
process is recursive regardless of whether a dependency is
already satisfied.
but you should be just fine doing 但你应该做得很好
pip install PySide
if for some reason you don't want to upgrade other packages installed by pip 如果由于某种原因你不想升级由pip安装的其他软件包
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.