一、下载
下载Anaconda-打开Anaconda Navigator
二、问题&解决
问题1:jupyter notebook不显示in、out、Nbextensions
解决:
参考了【jupyter notebook中插件 nbextensions 安装失败分析与解决方法】这篇文章,才解决了问题。总的来说是因为jupyter notebook版本过高,默认安装为7.0.8,后在创建的新环境中改为6.4.11,适配python3.10。同时按照上述参考文章中的命令进行操作安装。
注意:打开Anaconda-Powershell Prompt写命令。
再进入jupyter notebook,显示了in、out、Nbextensions的标识。
问题2:Nbextensions打开后是空的,没有设置选项可选。
解决:
原因在于新环境中没有安装 nbextensions_configurator。参考了【jupyter notebook 代码自动补全、代码高亮】这篇文章,进行安装并设置。
问题3:如何自定义浏览器打开jupyter notebook
解决:
参考更改Jupyter Notebook打开的默认浏览器(切换到Edge为例),先在Powershell Prompt中通过命令生成jupyter_notebook_config.py文件,再通过记事本打开jupyter_notebook_config.py,使用查找功能。
搜索 c.NotebookApp.browser 在210行(使用旧版jupyter notebook生成的)
或 c.ServerApp.browser 在688行 (使用最新版jupyter notebook生成的)
在该行下方添加相应的语句并保存即可。
例如:指定谷歌浏览器打开,将名称和路径替换即可。
问题4:此时打开 pycharm 跑代码出现 import 报错
解决:
删除解释器......
删除新环境......
没用......
原因在于之前安装了python3.10后,安装了一些跑代码需要的库。但是Anaconda又进行了一次全面的库安装,导致pycharm python3.10解释器中库重复安装,导致import报错。
卸载Anaconda......(简单粗暴(~ ̄▽ ̄)~)
有用!Anaconda安装的库随着卸载自动删除,pycharm python3.10解释器中只剩之前手动安装的库,没有重复。import报错解决~
改为pip安装jupyter notebook
cmd命令如下:
安装最新版
pip install jupyter notebook -i https://pypi.tuna.tsinghua.edu.cn/simple
安装指定版本
pip install jupyter notebook==6.4.11 -i https://pypi.tuna.tsinghua.edu.cn/simple
(但是指定版本安装失败 o(TヘTo),6.5.4也不行)
安装插件(但是不能在最新版上显示)
pip install jupyter_contrib_nbextensions -i https://pypi.mirrors.ustc.edu.cn/simple
pip install jupyter_nbextensions_configurator
输入 jupyter notebook 复制cmd出现的包含端口的链接在浏览器打开即可
问题5:jupyter notebook 如何更改默认路径并用快捷方式打开
解决:
参考更改Jupyter Notebook的默认路径,亲测有效。
生成一个py文件
jupyter notebook --generate-config
根据cmd显示路径找到该文件
用记事本打开,查找The directory to,找到下图中这一行(在981行)
把 c.ServerApp 前的 # 去掉,在单引号中间输入指定路径
参考从零开始!Jupyter Notebook的安装教程(附带pip和Python的安装教程)
文件中搜索 jupyter-notebook.exe
打开所在位置,发送到桌面快捷方式
双击运行即可跳转到浏览器网页
注意:运行过程中,cmd不能关上
三、参考
【jupyter notebook中插件 nbextensions 安装失败分析与解决方法】
jupyter notebook 代码自动补全、代码高亮
更改Jupyter Notebook打开的默认浏览器(切换到Edge为例)