【问题标题】:No module named 'folium.plugins', Python 3.6没有名为“folium.plugins”的模块,Python 3.6
【发布时间】:2018-06-13 14:01:09
【问题描述】:

我正在尝试将 folium 导入我正在使用的 Jupyter 笔记本中,但我似乎无法解决 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'

【问题讨论】:

    标签: python jupyter-notebook geopandas folium


    【解决方案1】:

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

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

    【讨论】:

    • 我自己试过了,可以确认它有效。为什么这不能直接起作用是一个谜。
    猜你喜欢
    • 2017-11-21
    • 1970-01-01
    • 1970-01-01
    • 2020-08-26
    • 2018-10-26
    • 1970-01-01
    • 1970-01-01
    • 2018-12-21
    • 2018-01-14
    相关资源
    最近更新 更多