简体   繁体   English

使用tqdm显示进度条有错误“未检测到Widget Javascript ...

[英]Displaying progress bar using tqdm has error "Widget Javascript not detected…

I'm trying to display progress bar using tqdm. 我正在尝试使用tqdm显示进度条。 My system is windows 7 64-bits. 我的系统是Windows 7 64位。 Installing tqdm using conda install tqdm is not applicable. 使用conda conda install tqdm不适用。 Therefore, I installed tqdm from https://anaconda.org/conda-forge/tqdm using a command in anaconda prompt as follows: 因此,我使用anaconda提示符中的命令从https://anaconda.org/conda-forge/tqdm安装了tqdm,如下所示:

conda install -c conda-forge tqdm=4.8.4

I test it with the following example 我用以下示例测试它

from tqdm import tnrange, tqdm_notebook
from time import sleep

for i in tnrange(4,desc='1st loop'):
    for j in tnrange(10, desc='2nd loop'):
        sleep(0.01)

IPython console displays the following message: IPython控制台显示以下消息:

Widget Javascript not detected.  It may not be installed properly. Did you enable the widgetsnbextension? If not, then run "jupyter nbextension enable --py --sys-prefix widgetsnbextension"

May I know how to fix this problem? 我可以知道如何解决这个问题吗? Thank you in advance. 先感谢您。

The error happens because you can't evaluate things that were designed to run exclusively in the Jupyter notebook, in Spyder's IPython Console. 发生错误是因为您无法在Spyder的IPython控制台中评估专门在Jupyter笔记本中运行的内容。

That's because they use frontends built with different technologies: the notebook with HTML, CSS and Javascript and the IPython console (which relies on the qtconsole package) with the Qt graphical toolkit. 这是因为他们使用了使用不同技术构建的前端:带有HTML,CSS和Javascript的笔记本以及带有Qt图形工具包的IPython控制台(依赖于qtconsole包)。

This is an old error of IPython. 这是IPython的一个老错误。 You need to install the latest ipywidgets package (use conda) and maybe update Jupyter/IPython too. 您需要安装最新的ipywidgets软件包(使用conda),也可以更新Jupyter / IPython。

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

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