Code Monkey home page Code Monkey logo

Comments (14)

97612336 avatar 97612336 commented on June 12, 2024 1

在issue 23看到跟我同样报错的信息,看到作者提交了commit和终止了问题后
我把作者的回复操作试了一遍
但是发现还是没有成功解决我的 问题
这是我的错误信息
phantomjs version: 2.1.1

Generating file ...
Traceback (most recent call last):
File "E:\学习作业\毕业设计\爬虫\数据分析\output_jinjiang.py", line 10, in
bar.render(path='snapshot.png', pixel_ratio=3)
File "D:\Program Files\python\lib\site-packages\pyecharts\base.py", line 146, in render
**kwargs
File "D:\Program Files\python\lib\site-packages\pyecharts_snapshot\environment.py", line 35, in render_chart_to_file
make_a_snapshot(tmp_file_path, path, delay=delay, verbose=verbose)
File "D:\Program Files\python\lib\site-packages\pyecharts_snapshot\main.py", line 99, in make_a_snapshot
raise OSError(content_array)
OSError: ["ReferenceError: Can't find variable: echarts\n\n undefined:1\nnull\n"]
[Finished in 6.0s]

使用的是有我自己的代码和作者的案例代码,还有尝试了作者说的引擎方式,但都是同样的错误
无论是这个案例
r 5pdsi l_saecr_ wl7t s
还是这个案例
`from pyecharts import Bar, Line
from pyecharts.engine import create_default_environment

bar = Bar("我的第一个图表", "这里是副标题")
bar.add("服装", ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90])

line = Line("我的第一个图表", "这里是副标题")
line.add("服装", ["衬衫", "羊毛衫", "雪纺衫", "裤子", "高跟鞋", "袜子"], [5, 20, 36, 10, 75, 90])

env = create_default_environment("html")

为渲染创建一个默认配置环境

create_default_environment(filet_ype)

file_type: 'html', 'svg', 'png', 'jpeg', 'gif' or 'pdf'

env.render_chart_to_file(bar, path='bar.html')
env.render_chart_to_file(line, path='line.html')`
都是报了同一个错误
我的尝试结果是,如果不用引擎的方式,我可以生成html文件,但是png文件始终无法生成

我的python版本是3.6
使用的是sublime text编辑器
版本信息有
pyecharts==0.5.11
pyecharts-javascripthon==0.0.6
pyecharts-jupyter-installer==0.0.3
pyecharts-snapshot==0.1.7
PyInstaller==3.3.1

以上是我的问题详细内容,跪求作者翻牌,谢谢大佬

这个问题我也遇到了,我的解决思路是使用echarts-scrappeteer库https://github.com/chfw/echarts-scrappeteer,然后用Python调用系统命令生成图片。

from pyecharts-snapshot.

chenjiandongx avatar chenjiandongx commented on June 12, 2024 1

image

from pyecharts-snapshot.

chenjiandongx avatar chenjiandongx commented on June 12, 2024

兄弟使用 pyecharts V1.0.0 版本吧,关于渲染图片这里有详细介绍

https://pyecharts.org/#/zh-cn/render_images

from pyecharts-snapshot.

97612336 avatar 97612336 commented on June 12, 2024

兄弟使用 pyecharts V1.0.0 版本吧,关于渲染图片这里有详细介绍

https://pyecharts.org/#/zh-cn/render_images

如何安装最新版本的 V 1.0.0 版本?pip 安装的最新版本是V 0.5.11的

from pyecharts-snapshot.

chfw avatar chfw commented on June 12, 2024

pyecharts-snapshot 最新版已经不用 phantomjs 了。

from pyecharts-snapshot.

97612336 avatar 97612336 commented on June 12, 2024

谢谢,他正常工作了

from pyecharts-snapshot.

1015zhc avatar 1015zhc commented on June 12, 2024

请问你是怎么解决的,我也遇到这个情况了。我的脚本晚上容易出现这种问题,白天重跑正常。

from pyecharts-snapshot.

wuchuting avatar wuchuting commented on June 12, 2024

from pyecharts-snapshot.

1015zhc avatar 1015zhc commented on June 12, 2024

from pyecharts-snapshot.

wuchuting avatar wuchuting commented on June 12, 2024

from pyecharts-snapshot.

1015zhc avatar 1015zhc commented on June 12, 2024

from pyecharts-snapshot.

sigma65535 avatar sigma65535 commented on June 12, 2024

我也遇到这个问题了,通过配置 js_host 参数,使用本地的js静态文件解决了

例如:
https://assets.pyecharts.org/assets/echarts.min.js 下载 放到 ./js/下边
Line(init_opts=InitOpts(js_host="./js/"))

from pyecharts-snapshot.

Kevenyf avatar Kevenyf commented on June 12, 2024

我也遇到这个问题了,通过配置 js_host 参数,使用本地的js静态文件解决了

例如: 将 https://assets.pyecharts.org/assets/echarts.min.js 下载 放到 ./js/下边 Line(init_opts=InitOpts(js_host="./js/"))

这个方法在win系统下好像不管用,依然会报错

from pyecharts-snapshot.

wuchuting avatar wuchuting commented on June 12, 2024

from pyecharts-snapshot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.