最近在学习python绘制地图和数据可视化
完成pyeacharts安装
pip install pyeacharts
地图安装
pip install echarts-countries-pypkg
pip install echarts-china-provinces-pypkg
pip install echarts-china-cities-pypkg
test.py
from pyecharts import options as opts
from pyecharts.charts import Map
from pyecharts.faker import Faker
c = (
Map()
.add("商家A", [list(z) for z in zip(Faker.provinces, Faker.values())], "china")
.set_global_opts(
title_opts=opts.TitleOpts(title="Map-VisualMap(分段型)"),
visualmap_opts=opts.VisualMapOpts(max_=200, is_piecewise=True),
)
.render("map_visualmap_piecewise.html")
)
运行test.py后
出现
pymysql.err.OperationalError: (1045, u"Access denied for user 'root'@'localhost' (using password: yes))
在网上看到很多人写的博客,比如换数据库密码,添加权限等方法。全部尝试后,都没有解决。
解决方案:
突然想到:可能是pyeacharts的问题
卸载
pip uninstall pyeacharts
pip uninstall echarts-countries-pypkg
pip uninstall echarts-china-provinces-pypkg
pip uninstall echarts-china-cities-pypkg
然后重新安装
如上安装步骤
最后解决问题