Google Colab:运行fig.write_image()的问题

时间:2020-10-29 17:41:11

标签: python plotly conda google-colaboratory

我正在尝试使用下一个代码来保存绘制的线条静态图像:

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)
网站https://plotly.com/python/static-image-export/中的

标记为安装eithe的请求:

!pip install -U kaleido

conda install -c plotly python-kaleido

使用pip安装kaleido时没有问题,但是创建了一个空文件。

因此,我尝试使用coda安装kaleido,但首先我必须安装coda,因为它不是Google Colab中的本机。我进行如下操作:

!pip安装conda

我没有问题。然后,我运行命令:

!conda install -c plotly python-kaleido

我有下一个答复:

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 to install conda as a standalone application, currently
supported install methods include the Anaconda installer and the miniconda
installer.  You can download the miniconda installer from
https://conda.io/miniconda.html.

现在,我卡住了。

非常感谢您能帮助您找到问题所在。谢谢。胡安。

0 个答案:

没有答案