jupyter NoteBook 网页空白各种解决方法(实在不行用pyCharm替代Chrome)

先说下我这边的原因,jupyter notebook版本太高了,js报错找不到text/plain,回退版本可以解决问题。

 

总结一下尝试了的方法:

 

方法1(无效): 把谷歌浏览器设置成默认打开方式

https://blog.csdn.net/xavier_muse/article/details/83830394

 

方法2(无效):升级谷歌浏览器

https://blog.csdn.net/u012724887/article/details/81667193

 

方法3(无效):清除cache

https://github.com/jupyter/notebook/issues/1627

 

方法4(无效):用火狐浏览器

 

方法5(无效):关闭防火墙,

或允许ipython.exe,pythonw.exe,jupyter-notebook.exe, jupyter.exe通过Windows防火墙通信

https://blog.csdn.net/xc555/article/details/81944979

https://blog.csdn.net/weixin_41813895/article/details/81739502

 

方法6(有效,重点尝试):回退jupyter版本(5.7.6版本更新导致的问题)

参考:https://blog.csdn.net/qq_35531549/article/details/88594422

pip uninstall jupyter notebook

pip install jupyter notebook==5.7.4

不行的话可以退得更老一点

方法7(有效):修改源码

参考:https://github.com/jupyter/notebook/pull/4468/files

路径:Anaconda\env\你的环境\Lib\site-packages\notebook\notebookapp.py

修改def init_mime_overrides(self):

    def init_mime_overrides(self):
        # On some Windows machines, an application has registered an incorrect
        # mimetype for CSS in the registry. Tornado uses this when serving
        # .css files, causing browsers to reject the stylesheet. We know the
        # mimetype always needs to be text/css, so we override it here.
        # mimetype for CSS and JavaScript in the registry.
        # Tornado uses this when serving .css and .js files, causing browsers to
        # reject these files. We know the mimetype always needs to be text/css for css
        # and application/javascript for JS, so we override it here.
        mimetypes.add_type('text/css', '.css')
        mimetypes.add_type('application/javascript', '.js')

终极杀招:用PyCharm替代chrome

谁用谁爽

 

原因分析

参考:http://blog.sina.com.cn/s/blog_17deaab6e0102ykin.html

按下F12,错误如下MIME type ('text/plain') is not executable

解决办法参考https://www.dropboxforum.com/t5/API-Support-Feedback/MIME-type-text-plain-is-not-executable/td-p/271231

也就是需要用application/javascript替换

### PyCharmJupyter Notebook 的功能对比 PyCharm 是一款强大的集成开发环境(IDE),特别适合用于Python编程以及Web应用开发。对于数据科学家而言,除了传统的代码编辑外,PyCharm还提供了对Jupyter Notebook的支持[^2]。 当考虑使用PyCharm来代替独立安装Jupyter Notebook时,需要注意两者虽然都能执行Python脚本并支持交互式计算,但在某些方面存在差异: - **内置支持**:现代版本的PyCharm Professional Edition已经集成了对Jupyter Notebook文件(.ipynb)的支持,允许用户直接在IDE内部打开、编辑和运行这些笔记本文件[^1]。 - **工作流程灵活性**:尽管可以在PyCharm中创建和管理Conda虚拟环境,并通过配置使该环境中安装有Jupyter服务从而实现Notebook的功能,但这并不意味着完全取代了原生Jupyter的应用场景。例如,在浏览器端展示丰富的可视化效果或者共享在线协作等方面,传统方式可能更便捷[^3]。 因此,如果主要需求是在单机环境下完成数据分析任务,则PyCharm确实能够满足大部分要求;但对于希望利用更多社区资源或参与远程团队合作的情况来说,单独部署Jupyter或许仍然是更好的选择。 ```python # 示例:如何在PyCharm中启动Jupyter服务器并与之交互 import os from IPython import get_ipython os.environ['PATH'] += ':/path/to/your/anaconda/bin' # 添加Anaconda路径到环境变量 get_ipython().run_line_magic('load_ext', 'autoreload') get_ipython().run_line_magic('autoreload', '2') print("This code demonstrates how to interact with a local Jupyter server from within PyCharm.") ```
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

朱铭德

五毛也是爱٩(●´৺`●)૭

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值