当前位置: 首页> 游戏> 游戏 > 关于Notebook环境的安装记录

关于Notebook环境的安装记录

时间:2025/8/9 15:21:40来源:https://blog.csdn.net/qq_49030008/article/details/139868746 浏览次数:1次

这是Windows下的,由于自己用的miniconda,所以很多都是自己手动搞的。

1.

首先执行conda install jupyter notebook,它能创建一个jupyter notebook的快捷方式(当然你也可以自己创建这个快捷方式)。

2.

但是不习惯notebook7,而且插件什么的不想重新弄,所以还是用了notebook6,但是使用notebook6的时候其他依赖包版本又会冲突,各种冲突,我这里试出来一种可以用的,所以记录一下:

anyio==3.7.1
arrow==1.3.0
backcall==0.2.0
entrypoints==0.4
fqdn==1.5.1
h11==0.14.0
httpcore==1.0.5
httpx==0.27.0
ipykernel==6.24.0
ipython==7.25.0
ipython-genutils==0.2.0
isoduration==20.11.0
json5==0.9.25
jsonpointer==2.1
jsonschema-specifications==2023.12.1
jupyter-client==6.1.12
jupyter-console==6.0.0
jupyter-highlight-selected-word==0.2.0
jupyter-lsp==2.2.5
jupyter-server==1.21.0
jupyter_contrib_core==0.4.2
jupyter_nbextensions_configurator==0.6.4
jupyterlab==3.5.0
jupyterlab_server==2.27.2
lxml==5.2.2
mistune==3.0.2
nbclassic==0.5.6
nbclient==0.10.0
nbconvert==7.16.4
nbformat==5.10.4
notebook==6.4.0
pickleshare==0.7.5
prompt-toolkit==2.0.10
PyQt5==5.15.10
referencing==0.35.1
setuptools==69.5.1
simplegeneric==0.8.1
tomli==2.0.1
tornado==6.4.1
traitlets==5.9.0
types-python-dateutil==2.9.0.20240316
uri-template==1.3.0
wcwidth==0.2.13
webcolors==24.6.0
wheel==0.43.0

用的话就是创建到一个requirements.txt里,然后执行pip install -r requirements.txt安装一下就好了,如果打开了jupyter notebook,一定要先关闭,要不然很多原来高版本的依赖包删不干净,会导致出错

3.

找到jupyter notebook的快捷方式点击属性,在目标输入:

jupyter notebook

然后点击应用,它会自动重定向到:path\jupyter.exe notebook,如果它没有自动重定向,可能要自己找到jupyter.exe的路径改一下,然后就可以用了。

4.

内核需要搞一下:

添加内核首先进入到conda的某个环境里,执行下面的命令,安装本环境的IPython内核。show_name就是你想显示的名字。

python -m ipykernel install --user --name show_name

新环境如果没有安装ipykernel,先安装一下:pip install ipykernel 。(但是尽量别在装有jupyter notebook的环境中执行这个安装命令,会破坏依赖包的版本。

查看内核:

jupyter kernelspec list

删除内核:

jupyter kernelspec remove show_name

更改默认内核:
首先找到Jupyter配置文件:
Jupyter的配置文件通常位于用户的主目录下,名为 jupyter_notebook_config.py。
如果该文件不存在,你可以使用以下命令来生成它:jupyter notebook --generate-config

添加以下代码:

c.KernelSpecManager.default_kernel_name = 'your_kernel_name'

your_kernel_name替换为你想要设置为默认的内核名称。例如,如果你想要将base设置为默认内核,你应该使用:c.KernelSpecManager.default_kernel_name = 'base'
记得使用之前应该先创建名字为base的内核。

5.

设置为无密码:也是在Jupyter的配置文件中修改或者添加:c.NotebookApp.token = ''

6.

默认工作目录:
也是在Jupyter的配置文件中修改或者添加:

c.NotebookApp.notebook_dir = '你的路径'
关键字:关于Notebook环境的安装记录

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: