更改 jupyter 笔记本中的 python 版本
我通过 jupyter hub 使用 jupyter 笔记本和 jupyter 实验室。 目前jupyter识别的python版本是3.6.8。
我想将python版本设置为3.7.3。
服务器上安装的python版本如下。 (/usr/bin/python*)
jupyter Notebook 内核在 /usr/local/share/jupyter/kernels/python3/kernel.json 中设置如下,
如果将 argv 路径更改为“/usr/bin/python3”或'/usr/bin/python3.7',内核正忙,未建立连接。 TT 仅当 argv 路径为“/usr/bin/python 3.6”时,它才能正常工作。
- 设置代码
sudo apt-get install python3-pip
sudo pip3 install ipykernel
sudo jupyter kernelspec安装自我
I am using jupyter notebook and jupyter lab through jupyter hub.
Currently, the python version recognized by jupyter is 3.6.8.
I want to set the python version to 3.7.3.
The python version installed on the server is as follows. (/usr/bin/python*)
The jupyter notebook kernel is set as follows in /usr/local/share/jupyter/kernels/python3/kernel.json
If you change the argv path to '/usr/bin/python3' or '/usr/bin/python3.7', the kernel is busy and the connection is not made. TT
It works well only when argv path is '/usr/bin/python 3.6'.
- Setting Code
sudo apt-get install python3-pip
sudo pip3 install ipykernel
sudo jupyter kernelspec install-self
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
正如 这篇文章 所说,您需要创建新内核和此网站展示了如何操作 它
as this post says, you need to create a new kernel and this website shows how to do it
我通过重新安装以下软件包解决了这个问题。谢谢。
I solved it by reinstalling the below packages. thank you.
我必须将内核从 3.8 更改为 3.11
转到此位置 - ~/.local/share/jupyter/kernels/anaconda
你将看到一个 python 目录 cd pythonX
然后打开kernel.json文件,你会看到类似这样的东西
我只是将python3.8更改为python3.11,它对我有用(我的情况下已经安装了python3.11)
I had to change my kernel from 3.8 to 3.11
Go to this location - ~/.local/share/jupyter/kernels/anaconda
you will see a python directory cd pythonX
then open the kernel.json file , you will see something like this
I simply changed python3.8 to python3.11 and it worked for me (python3.11 was already installed in my case)