电脑怎么打开npz文件(双击打开ipynb文件)

因为ipynb文件是jupyter notebook的文件,每次打开总要先打开jupyter notebook,再更改路径,打开对应的ipynb文件,则很麻烦。

所以想用双击就直接打开ipynb文件。

双击自动打开文件

找到Jupyter Notebook的快捷方式,点击右键-属性-快捷方式-目标里,复制出来,如下图所示

电脑怎么打开npz文件(双击打开ipynb文件)(1)

C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\cwp.py C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py %USERPROFile%

把该段文本复制到一个txt文本中,替换最后的 %USERPROFILE% 为 %1,注意保留空格。

C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\cwp.py C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\python.exe C:\ProgramData\Anaconda3\Scripts\jupyter-notebook-script.py %1

将该文本保存为open_ipynb.bat文件。

点击.ipynb文件右键-常规-打开方式,选择open_ipynb.bat文件。这样就可以直接双击自动打开ipynb文件了。

电脑怎么打开npz文件(双击打开ipynb文件)(2)


到这里就已经ok了。如果有报错的话,请看下面。



启动错误

按照上面修改.bat文件,双击之后,会跳出下面404:not Found错误,“You are requesting a page that does not exist!”

电脑怎么打开npz文件(双击打开ipynb文件)(3)

仔细排查原因,在Jupyter Notebook 启动在命令窗口下发现会显示错误:

Error loading server extension jupyterlab Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 321, in __init__ self._run(['node', 'node-version-check.js'], cwd=HERE, quiet=True) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 1165, in _run proc = Process(cmd, **kwargs) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\process.py", line 73, in __init__ self.proc = self._create_process(cwd=cwd, env=env) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\process.py", line 131, in _create_process cmd[0] = which(cmd[0], kwargs.get('env')) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\jlpmapp.py", line 59, in which raise ValueError(msg) ValueError: Please install nodejs 5 and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "C:\ProgramData\Anaconda3\lib\site-packages\notebook\notebookapp.py", line 1454, in init_server_extensions func(self) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\extension.py", line 111, in load_jupyter_server_extension info = get_app_info(app_dir) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 244, in get_app_info handler = _AppHandler(app_dir, logger) File "C:\ProgramData\Anaconda3\lib\site-packages\jupyterlab\commands.py", line 324, in __init__ raise ValueError(msg) ValueError: Please install nodejs 5 and npm before continuing installation. nodejs may be installed using conda or directly from the nodejs website.

原因:因为我使用的Anaconda3中jupyterlab 0.31.4版本存在错误,更新即可消除该错误。

解决方法:打开anaconda navigator,点击右上角,update Application

电脑怎么打开npz文件(双击打开ipynb文件)(4)

或者直接在命令行里输入直接升级jupyterlab

pip install --upgrade jupyterlab

,

免责声明:本文仅代表文章作者的个人观点,与本站无关。其原创性、真实性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容文字的真实性、完整性和原创性本站不作任何保证或承诺,请读者仅作参考,并自行核实相关内容。文章投诉邮箱:anhduc.ph@yahoo.com

    分享
    投诉
    首页