我正在尝试使用为我的笔记本生成幻灯片nbconvert
。使用 windows、jupyter 和 python 3。
https://nbconvert.readthedocs.io/en/latest/usage.html#convert-revealjs
我在管理员模式下的命令外壳中运行命令:
jupyter nbconvert C:\files\notebook.ipynb --to slides --post serve
files\ 目录包含一个名为reveal.js
.
引发以下错误,
[NbConvertApp] Converting notebook C:\files\notebook.ipynb to slides
[NbConvertApp] Writing 379320 bytes to C:\files\notebook.slides.html
[NbConvertApp] Serving local reveal.js
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\Scripts\jupyter-nbconvert-script.py", line 5, in <module>
main()
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\jupyter_core\application.py", line 267, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\traitlets\config\application.py", line 658, in launch_instance
app.start()
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 293, in start
self.convert_notebooks()
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 457, in convert_notebooks
self.convert_single_notebook(notebook_filename)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 430, in convert_single_notebook
self.postprocess_single_notebook(write_results)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\nbconvert\nbconvertapp.py", line 402, in postprocess_single_notebook
self.postprocessor(write_results)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\nbconvert\postprocessors\base.py", line 28, in __call__
self.postprocess(input)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\nbconvert\postprocessors\serve.py", line 87, in postprocess
http_server.listen(self.port, address=self.ip)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\tornado\tcpserver.py", line 126, in listen
sockets = bind_sockets(port, address=address)
File "C:\Users\user\AppData\Local\Continuum\Anaconda3\lib\site-packages\tornado\netutil.py", line 194, in bind_sockets
sock.bind(sockaddr)
OSError: [WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
这表明该端口已在本地使用-我相信它默认为 8000。运行 nbcovert 命令时有没有办法指定端口?例如不是 8000。
NB 该文件notebook.slides.html
正在创建中,我可以http.server
在不同的端口上手动提供它。