Skip to content
This repository has been archived by the owner on Feb 27, 2020. It is now read-only.

mac无法导入pyecharts #5

Open
Mayjiao opened this issue Jun 6, 2019 · 0 comments
Open

mac无法导入pyecharts #5

Mayjiao opened this issue Jun 6, 2019 · 0 comments

Comments

@Mayjiao
Copy link

Mayjiao commented Jun 6, 2019

Mac通过pip安装pyecharts, sudo pip install pyecharts -U
然后通过 pip list | grep pyecharts,看到下边确实有这个模块
pyecharts 1.0.0
运行demo的代码,报错如下
Traceback (most recent call last):
File "exercise_10.py", line 3, in
from pyecharts.charts import Bar
File "/Library/Python/2.7/site-packages/pyecharts/init.py", line 3, in
from pyecharts import charts, commons, components, datasets, options, render, scaffold
File "/Library/Python/2.7/site-packages/pyecharts/charts/init.py", line 4, in
from ..charts.basic_charts.bar import Bar
File "/Library/Python/2.7/site-packages/pyecharts/charts/basic_charts/bar.py", line 15
def init(self, init_opts: Union[opts.InitOpts, dict] = opts.InitOpts()):
^
SyntaxError: invalid syntax
请问大神们是什么问题啊?demo 代码如下
from pyecharts.charts import Bar
from pyecharts import options as opts

bar = (
Bar()
.add_xaxis(["衬衫", "毛衣", "领带", "裤子", "风衣", "高跟鞋", "袜子"])
.add_yaxis("商家A", [114, 55, 27, 101, 125, 27, 105])
.add_yaxis("商家B", [57, 134, 137, 129, 145, 60, 49])
.set_global_opts(title_opts=opts.TitleOpts(title="某商场销售情况"))
)
bar.render()

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant