You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Jupyter Notebook无法打开报expected string or bytes-like object错误求助

解决Anaconda Base环境Jupyter Notebook启动报错“expected string or bytes-like object”

问题背景

为在Jupyter Notebook中安装TensorFlow,创建虚拟环境后,虚拟环境的Jupyter可正常打开,但原常用的Anaconda Base环境Jupyter Notebook无法启动,报错“expected string or bytes-like object”,删除虚拟环境后问题仍存在。

修复方案

1. 重置Jupyter配置文件

配置文件损坏是常见诱因,执行以下命令强制重新生成配置文件:

jupyter notebook --generate-config --force

2. 重装Base环境的Jupyter相关依赖

虚拟环境操作可能导致base环境的Jupyter包版本冲突,彻底重装相关组件:

conda activate base
conda remove --force jupyter jupyter_core jupyter_client ipython ipykernel
conda install jupyter ipython ipykernel

3. 清理残留环境变量(可选)

检查系统PATH环境变量,若存在已删除虚拟环境的路径,将其移除后重启终端,再尝试启动Jupyter。

4. 验证修复

执行jupyter notebook命令,确认Base环境的Jupyter Notebook是否能正常启动。

内容的提问来源于stack exchange,提问作者Valent Aderiandra

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.22 17:27:00