无法在Jupyter中新建Python3文件,求重置环境恢复默认选项
彻底卸载Jupyter并重置环境配置
一、完全清理Jupyter相关组件
- 卸载所有Jupyter关联包
- 若曾用pip安装:
pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console ipython ipykernel ipywidgets nbconvert nbformat notebook qtconsole traitlets - 若曾用conda安装:
conda remove -y jupyter jupyter_core jupyter-client jupyter-console ipython ipykernel ipywidgets nbconvert nbformat notebook qtconsole traitlets
- 若曾用pip安装:
- 删除Jupyter配置与缓存目录
rm -rf ~/.jupyter rm -rf ~/.local/share/jupyter rm -rf ~/.cache/jupyter - 移除多余内核配置
先查看所有已注册内核,再删除误创建的conda环境内核:# 列出所有内核路径 jupyter kernelspec list # 删除指定内核(替换为你的误创建环境名) jupyter kernelspec remove [你的误创建环境名]
二、重新安装并配置目标环境
- 确保系统Python3为brew安装的版本
brew install python3 - 给Python3注册Jupyter内核
python3 -m pip install ipykernel python3 -m ipykernel install --user --name python3 --display-name "Python 3" - 重新安装Jupyter
python3 -m pip install jupyter
三、验证效果
启动Jupyter Notebook:
jupyter notebook
点击「新建」选项,此时应仅显示Python 2和Python 3的可选内核。
内容的提问来源于stack exchange,提问作者Lusian
相关产品推荐
相关产品推荐

