jupyternotebook不显示pyecharts内容
时间: 2023-08-08 09:06:28 浏览: 298
要在Jupyter Notebook中显示pyecharts内容,你需要进行一些配置和安装。首先,你需要获取pyecharts-assets项目并安装扩展插件。你可以通过以下步骤完成这个过程:\[1\]
1. 克隆pyecharts-assets项目:在终端中运行以下命令:git clone https://github.com/pyecharts/pyecharts-assets.git
2. 安装扩展插件:进入pyecharts-assets目录,并运行以下命令:jupyter nbextension install assets,然后运行jupyter nbextension enable assets/main
接下来,你需要配置pyecharts的全局HOST。你可以在Notebook的顶部声明CurrentConfig.ONLINE_HOST为OnlineHostType.NOTEBOOK_HOST,这样所有图形的静态资源文件都会来自刚启动的服务器。你可以使用以下代码实现这一步骤:\[1\]
from pyecharts.globals import CurrentConfig, OnlineHostType
CurrentConfig.ONLINE_HOST = OnlineHostType.NOTEBOOK_HOST
如果你仍然无法在Jupyter Notebook中显示pyecharts内容,你可以尝试另一种方法。你可以使用matplotlib库来显示pyecharts生成的图片。你可以使用以下代码实现这一步骤:\[3\]
import matplotlib.image as mpimg
import matplotlib.pylab as plt
im03_01 = mpimg.imread("D:/03第3章/03保存图片/03-01疫情分布(中国地图展示).png")
plt.axis('off')
plt.imshow(im03_01)
通过这些配置和方法,你应该能够在Jupyter Notebook中成功显示pyecharts内容。
#### 引用[.reference_title]
- *1* [Jupyter notebook无法显示pyecharts 图形界面 ----解决方法](https://blog.csdn.net/weixin_45215649/article/details/107933750)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *2* [Jupyter notebook无法显示pyecharts](https://blog.csdn.net/u013817846/article/details/126058525)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [在Jupyter Notebook中查看Pyecharts生成的图片](https://blog.csdn.net/qq_40177458/article/details/127611400)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文