Anaconda Prompt启动Jupyter Notebook失败及certifi导入错误求助
解决方案
问题1:启动Jupyter Notebook时出现ImportError: cannot import name 'where' from 'certifi'
解决步骤:
- 激活
finance虚拟环境:conda activate finance - 卸载当前损坏或版本不兼容的
certifi包:
若使用conda管理依赖,执行:pip uninstall -y certificonda remove certifi - 重新安装稳定兼容版本的
certifi:
或通过conda安装:pip install certifi==2023.7.22conda install certifi - 再次尝试启动Jupyter Notebook:
jupyter notebook
问题2:安装jupyter_contrib_nbextensions时事务回滚,出现ModuleNotFoundError: No module named 'notebook.nbextensions'
解决步骤:
方案A:修复现有环境依赖
- 确保
finance环境中已正确安装notebook:conda activate finance conda install notebook - 先安装依赖核心包,再安装nbextensions:
conda install -c conda-forge jupyter_contrib_core conda install -c conda-forge jupyter_contrib_nbextensions - 若conda安装失败,尝试用pip安装并配置:
pip install jupyter_contrib_nbextensions jupyter contrib nbextension install --user
方案B:重新创建干净环境(推荐,避免依赖混乱)
- 删除现有
finance环境:conda remove -n finance --all - 重新创建指定Python版本的环境(匹配原环境的3.8版本),并预装
notebook:conda create -n finance python=3.8 notebook - 激活环境后安装所需业务库及nbextensions:
conda activate finance # 安装你的其他业务依赖库 conda install -c conda-forge jupyter_contrib_nbextensions
内容的提问来源于stack exchange,提问作者gfx Prog
相关产品推荐
相关产品推荐

