AssertionError: You cannot render this Element if it is not in a Figure

AssertionError: You cannot render this Element if it is not in a Figure

我写了下面的代码:

import folium
map = folium.Marker(location=[80, -100], zoom_start=6, tiles="Mapbox Bright")
fg = folium.FeatureGroup(name="My map")
fg.add_child(folium.Marker(location=[80, -100], popup="Marker Here", icon=folium.Icon(color="green")))

map.save("Map.html")

我不断收到此错误消息:

Traceback (most recent call last):
  File "c:/Users/king/Desktop/applications/mapping/maps.py", line 6, in <module>
    map.save("Map.html" )
  File "C:\Users\king\AppData\Local\Programs\Python\Python38-32\lib\site-packages\branca\element.py", line 169, in save
    html = root.render(**kwargs)
  File "C:\Users\king\AppData\Local\Programs\Python\Python38-32\lib\site-packages\branca\element.py", line 614, in render
    assert isinstance(figure, Figure), ('You cannot render this Element '
AssertionError: You cannot render this Element if it is not in a Figure.

我正在尝试保存正在构建的地图的进度,但它一直显示错误消息

根据 docs 应该将 Marker 添加到 Map

map = folium.Map(
        location=[80, -100],
        zoom_start=6,
        tiles="Mapbox Bright"
      )

fg = folium.FeatureGroup(name="My map")

folium.Marker(
    location=[80, -100],
    popup="Marker Here",
    icon=folium.Icon(icon='green')
).add_to(map)