SoFunction
Updated on 2024-10-29

Solve pyecharts in jupyter notebook use error problem

It is recommended to download pyecharts(0.) version, if you use pip install pyecharts to install V1 version(e.g.1.7.1) by default, you will get the following error:

1、Bar module import problem

from pyecharts import Bar

Report an error:

cannot import name ‘Bar'

Solution:

from import Bar

2、Bar Use Error Reporting

from pyecharts import Bar
bar =Bar("My first chart.", "Here's the subtitle.") # Title
("Clothing.", #hashtag
  ["Shirt.", "Wool sweater.", "Chiffon shirt.", "Pants.", "High heels.", "Socks."],#x coordinate
  [5, 20, 36, 10, 75, 90]) #y coordinate
# is_more_utils = True #Show right toolbar
# bar.show_config() # print all parameters
('my_first_chart.html')#Save the chart columns
bar

Report an error:

TypeError: init() takes from 1 to 2 positional arguments but 3 were given

Try commenting out the error line:

#bar =Bar("My first chart", "Here is the subtitle")

There will also be a new error: 'Bar' object has no attribute 'add'

Solution: Uninstall and install the old version

pip install pyecharts==0.5.10 -i /simple/ --trusted-host

If the installation reports an error (mac system):

Failed building wheel for dukpy
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
error: command 'gcc' failed with exit status 1

Solution:

1、Installation of xcode

xcode-select --install

2, and then install pyecharts-0.5.10

3, after the results of the installation restart jupyter notebook can be

Above this article to solve the pyecharts in jupyter notebook in the use of the problem of reporting errors is all I have shared with you, I hope to give you a reference, but also hope that you support me more.