简体   繁体   English

python2.7:jupyter notebook 中的 matplotlib 不能使用 qt

[英]python2.7: matplotlib in jupyter notebook can't use qt

I've installed python2.7 and installed matplotlib using pip.我已经安装了python2.7并使用 pip 安装了matplotlib When I execute:当我执行:

% matplotlib qt

It get the error:它得到错误:

No module named pyqt4, pyqt5...

So I installed pyqt4 using .whl file, and the error becomes:所以我使用.whl文件安装了pyqt4 ,错误变为:

No module named pyqt5

I've searched that pyqt5 can be easy installed using pip3 install pyqt5 , but not for pip .我已经搜索到pyqt5可以使用pip3 install pyqt5轻松安装,但不适用于pip

Also I remembered that I have solved this problem by downgrading jupyter before but I can't remember it exactly.我还记得我之前通过降级jupyter解决了这个问题,但我记不清了。

I have searched the web for a while but can't find a solution, how can I get rid of this error in a most simple way?我在网上搜索了一段时间,但找不到解决方案,如何以最简单的方式摆脱此错误?

在此处输入图片说明

There are different ways to specify the backend for matplotlib有多种方法可以为 matplotlib 指定后端

Using Environment Variable使用环境变量

Set a environment variable in windows MPLBACKEND with value as Qt4Agg .在 Windows MPLBACKEND设置一个环境变量,值为Qt4Agg

See this for more available backend看到这个更多可用的后端

https://matplotlib.org/tutorials/introductory/usage.html#what-is-a-backend https://matplotlib.org/tutorials/introductory/usage.html#what-is-a-backend

Using names使用名称

Also you can try %matplotlib qt4 instead of %matplotlib qt你也可以尝试%matplotlib qt4而不是%matplotlib qt

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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