标签:使用命令 file 没有 call stp trait tle 阿里云 失败
安装ipywidgets后,我在运行下述代码时,出现了错误``
import torch
import torchvision
import torchvision.transforms as transforms
import matplotlib.pyplot as plt
import ipywidgets as widgets
import sys
sys.path.append("..")
import d2lzh_pytorch as d2l
错误显示:
Downloading http://fashion-mnist.s3-website.eu-central-1.amazonaws.com/train-images-idx3-ubyte.gz to C:\Users\木子/Datasets/FashionMNIST\FashionMNIST\raw\train-images-idx3-ubyte.gz
Widget Javascript not detected. It may not be installed or enabled properly.
A Jupyter widget could not be displayed because the widget state could not be found. This could happen if the kernel storing the widget is no longer available, or if the widget state was not saved in the notebook. You may be able to create the widget by running the appropriate cells.
错误截图:
可以用命令pip search widgetsnbextension
检查是否能在后台找到这个插件,如果不能就需要重新安装。可以尝试下面这个解决方法:
然而上面的运行我并没有解决,于是进行了后续步骤。我安装的版本是4.x,查看了一系列解决方案,大概指这个4.X版本在jupyter notebook中工作,会有一些不支持。安装5.0.0版本,就可以解决这个版本存在“找不到
插件的问题”。于是我又重新安装5.0.0版本。(详看第三点)
pip install ipywidgets==5.0.0
(失败,因为我已经安装了4.x版本,无法下载。)错误代码:
Installing collected packages: ipywidgets
Found existing installation: ipywidgets 6.0.0
ERROR: Cannot uninstall 'ipywidgets'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
错误截图:
这个是anaconda的保护机制,显示:这是一个distutils的安装项目,因此,我们无法准确判断哪些文件属于它,这将导致只有部分卸载。,防止环境打乱。在卸载时,这种错误比较常见,实在想卸载,也可通过修改第三方文件夹的权限。(参考其他博文)
pip install --ignore-installed --upgrade ipywidgets==5.0.0 -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
这个命令--ignore-installed
可以忽略已经安装的版本,安装特定版本。后面为了网速快,特地加了阿里云的镜像。
错误代码:
Installing collected packages: attrs, setuptools, zipp, importlib-metadata, six, pyrsistent, jsonschema, ipython-genutils, pywin32, decorator, traitlets, jupyter-core, nbformat, Send2Trash, tornado, prometheus-client, MarkupSafe, jinja2, pywinpty, terminado, pyzmq, python-dateutil, jupyter-client, pickleshare, colorama, parso, jedi, pygments, backcall, wcwidth, prompt-toolkit, ipython, ipykernel, webencodings, bleach, entrypoints, testpath, defusedxml, mistune, pandocfilters, nbconvert, notebook, widgetsnbextension, ipywidgets
ERROR: Could not install packages due to an EnvironmentError: [WinError 5] 拒绝访问。: 'd:\\installsoftware\\anaconda\\envs\\spyder_py3.5\\Lib\\site-packages\\win32\\win32api.pyd'
Consider using the `--user` option or check the permissions.
错误截图:
大意是拒绝访问,由于环境错误无法安装包。同时给出了解决办法加上
--user
。
pip install --ignore-installed --upgrade ipywidgets==5.0.0 --user -i http://mirrors.aliyun.com/pypi/simple/ --trusted-host mirrors.aliyun.com
截图:
这里面有很多警告,但是还好啦,终于安装成功了。到此,这个插件找寻不到的问题得到解决。
GitHub讨论区参考:https://github.com/jupyter/notebook/issues/1386
关于ipywidgets插件,错误'Widget Javascript not detected. It may not be installed or enabled properly.'
标签:使用命令 file 没有 call stp trait tle 阿里云 失败
原文地址:https://www.cnblogs.com/somedayLi/p/12356332.html