无法启动Jupyter Notebook ModuleNotFoundError:没有名为“资源"的模块 [英] Can't launch Jupyter Notebook ModuleNotFoundError: No module named 'resource'

查看:616
本文介绍了无法启动Jupyter Notebook ModuleNotFoundError:没有名为“资源"的模块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经从命令行使用Jupyter Notebook了一个月,今天我没有关闭正在运行的笔记本电脑并使笔记本电脑进入睡眠状态达4个小时.重新打开笔记本电脑后,我尝试再次运行笔记本电脑,此后我一直遇到相同的错误.请帮帮我.

I've been using Jupyter Notebook from the command line for a month now, today I didn't shut the running notebook and put my laptop to sleep for 4 hours. After turning my laptop back on I tried to run the notebook again and I'm getting the same error ever since. Please help me out.

Traceback (most recent call last):
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\utils\timing.py", line 27, in <module>
    import resource
ModuleNotFoundError: No module named 'resource'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\Chinmay\AppData\Local\Programs\Python\Python38-32\Scripts\jupyter-notebook.EXE\__main__.py", line 9, in <module>
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\jupyter_core\application.py", line 270, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 663, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1769, in initialize
    self.init_webapp()
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1451, in init_webapp
    self.web_app = NotebookWebApplication(
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 153, in __init__
    settings = self.init_settings(
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 269, in init_settings
    nbextensions_path=jupyter_app.nbextensions_path,
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\notebook\notebookapp.py", line 1120, in nbextensions_path
    from IPython.paths import get_ipython_dir
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\__init__.py", line 49, in <module>
    from .terminal.embed import embed
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\terminal\embed.py", line 19, in <module>
    from IPython.terminal.ipapp import load_default_config
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\terminal\ipapp.py", line 30, in <module>
    from IPython.core.magics import ScriptMagics
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\core\magics\__init__.py", line 21, in <module>
    from .execution import ExecutionMagics
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\core\magics\execution.py", line 46, in <module>
    from IPython.utils.timing import clock, clock2
  File "c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\utils\timing.py", line 64, in <module>
    clocku = clocks = clock = time.clock
AttributeError: module 'time' has no attribute 'clock'```

推荐答案

打开此文件:c:\users\chinmay\appdata\local\programs\python\python38-32\lib\site-packages\IPython\utils\timing.py

  1. import time更改为import timeit
  2. time.clock更改为timeit.default_timer
  1. change import time to import timeit
  2. change time.clock to timeit.default_timer

这对我有用,应该对你有用.

This worked for me, should work for you.

这篇关于无法启动Jupyter Notebook ModuleNotFoundError:没有名为“资源"的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆