Skip to main content
 首页 » 编程设计

python之没有名为 'folium.plugins' 的模块,Python 3.6

2025年01月19日7zhengyun_ustc

我正在尝试将 folium 导入到我正在使用的 Jupyter notebook 中,但我似乎无法解决 Folium 库的导入问题。有没有其他人解决过这个问题?

在安装folium遇到错误后,我使用了这个线程中提供的解决方案来安装模块:

Python 3.6 Module cannot be found: Folium

简短摘要:从 github 克隆,使用命令行安装。

这行得通,但我在尝试将 folium 导入我的笔记本时遇到了以下错误:

输入:

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 

输出:

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' 

请您参考如下方法:

我不知道为什么会这样,但我遇到了同样的问题,最后用

解决了
import folium.plugins as plugins 
 
cluster = folium.FeatureGroup(name='cluster') 
cluster.add_child(plugins.MarkerCluster(locations=coords, popups=popups)