我正在尝试使用以下代码保存绘图线静态图像:
import plotly
import plotly.express as px
fig = px.line(EFBCg_f[1:12], x='time(ms)', y="C(n)", width=800, height=200)
fig.show()
file='Results/filename.png'
fig.write_image(file)
Run Code Online (Sandbox Code Playgroud)
在网站https://plotly.com/python/static-image-export/中,标记为安装以下任一者的请求:
!pip install -U kaleido
Run Code Online (Sandbox Code Playgroud)
或者
conda install -c plotly python-kaleido
Run Code Online (Sandbox Code Playgroud)
我使用 pip 安装 kaleido 没有问题,但创建了一个空文件。
因此,我尝试使用 coda 安装 kaleido,但首先我必须安装 coda,因为它不是 Google Colab 原生的。我按如下方式进行:
!pip 安装 conda
我没有问题。然后,我运行命令:
!conda install -c plotly python-kaleido
Run Code Online (Sandbox Code Playgroud)
我有下一个回复:
ERROR: The install method you used for conda--probably either `pip install conda`
or `easy_install conda`--is not compatible with using conda as an application.
If your intention is …Run Code Online (Sandbox Code Playgroud) 当我尝试在“Google Colaboratory”中导入 geopandas 包时,出现错误“ModuleNotFoundError:没有名为“geopandas”的模块”。
我会感谢你的帮助。提前致谢。