No module named 'folium.plugins', Python 3.6

守給你的承諾、 提交于 2021-02-09 03:49:19

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!