【问题标题】:Google Colab: problems to run fig.write_image()Google Colab:运行 fig.write_image() 的问题
【发布时间】:2020-10-29 17:41:11
【问题描述】:

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

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/ 中,标记为安装以下任一请求:

!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.

现在,我卡住了。

如果您能帮助找出问题,我将不胜感激。谢谢你。胡安。

【问题讨论】:

  • pip install 是去这里的方式。您确定问题不是您的代码吗?例如,this tutorial 中的示例是否有效?

标签: python plotly conda google-colaboratory


【解决方案1】:

试试这个(tnx to Greg Hogg https://youtu.be/qNF1HqBvpGE

!wget https://github.com/plotly/orca/releases/download/v1.2.1/orca-1.2.1-x86_64.AppImage -O /usr/local/bin/orca

!chmod +x /usr/local/bin/orca

!apt-get install xvfb libgtk2.0-0 libgconf-2-4

【讨论】:

    猜你喜欢
    • 2020-10-16
    • 1970-01-01
    • 2019-07-25
    • 1970-01-01
    • 1970-01-01
    • 2020-09-26
    • 2021-05-31
    • 2022-07-28
    • 2022-12-14
    相关资源
    最近更新 更多