IOError: [Errno 2] No such file or directory: 'nul'

enter the jupyter notebook error message in the console after installing jupyter as follows:

C:\Users\Administrator>jupyter notebook
Traceback (most recent call last):
  File "c:\python27\lib\runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "c:\python27\lib\runpy.py", line 72, in _run_code
    exec code in run_globals
  File "C:\Python27\Scripts\jupyter-notebook.EXE\__main__.py", line 9, in <module>
  File "c:\python27\lib\site-packages\jupyter_core\application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "c:\python27\lib\site-packages\traitlets\config\application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "c:\python27\lib\site-packages\traitlets\config\application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "c:\python27\lib\site-packages\notebook\notebookapp.py", line 1507, in initialize
    self.init_webapp()
  File "c:\python27\lib\site-packages\notebook\notebookapp.py", line 1270, in init_webapp
    self.jinja_environment_options
  File "c:\python27\lib\site-packages\notebook\notebookapp.py", line 156, in __init__
    default_url, settings_overrides, jinja_env_options)
  File "c:\python27\lib\site-packages\notebook\notebookapp.py", line 268, in init_settings
    nbextensions_path=jupyter_app.nbextensions_path,
  File "c:\python27\lib\site-packages\notebook\notebookapp.py", line 973, in nbextensions_path
    from IPython.paths import get_ipython_dir
  File "c:\python27\lib\site-packages\IPython\__init__.py", line 49, in <module>
    from .terminal.embed import embed
  File "c:\python27\lib\site-packages\IPython\terminal\embed.py", line 17, in <module>
    from IPython.core.interactiveshell import DummyMod, InteractiveShell
  File "c:\python27\lib\site-packages\IPython\core\interactiveshell.py", line 63, in <module>
    from IPython.utils import io
  File "c:\python27\lib\site-packages\IPython\utils\io.py", line 90, in <module>
    devnull = open(os.devnull, "w")
IOError: [Errno 2] No such file or directory: "nul"

I have tried many times (reinstall anconda, use native python, etc.) but it still doesn"t work. If any of the seniors have encountered this problem, please teach me the experience. Thank you.

Mar.02,2021

according to error troubleshooting, the relevant directory or file could not be found when opening os.devnull

reference: https://blog.csdn.net/itachi8.

Menu