问题
I am trying to import folium into a Jupyter notebook I'm working on and I cannot seem to solve the import issues with the Folium library. Has anyone else solved this problem?
After encountering an error installing folium, I used the solution provided in this thread to install the module:
Python 3.6 Module cannot be found: Folium
Short summary: clone from github, install using the commandline.
This worked, but instead I encountered the following error further down the line when trying to import folium into my notebook:
Input:
import pandas as pd
import geopandas as gpd
import numpy as np
from geopandas.tools import sjoin
import folium
from folium.plugins import MarkerCluster
from folium.element import IFrame
import shapely
from shapely.geometry import Point
import unicodedata
import pysal as ps
Output:
ModuleNotFoundError Traceback (most recent call
last)
<ipython-input-162-0ae99a5c599e> in <module>()
4 from geopandas.tools import sjoin
5 import folium
----> 6 from folium.plugins import MarkerCluster
7 from folium.element import IFrame
8 import shapely
ModuleNotFoundError: No module named 'folium.plugins'
回答1:
I have no idea why this works, but I was having the same problem and finally solved it with
import folium.plugins as plugins
cluster = folium.FeatureGroup(name='cluster')
cluster.add_child(plugins.MarkerCluster(locations=coords, popups=popups)
来源:https://stackoverflow.com/questions/48085110/no-module-named-folium-plugins-python-3-6