找不到 Python 3.6 模块:Folium
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/44617159/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Python 3.6 Module cannot be found: Folium
提问by Tyler Russell
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?
我正在尝试将 folium 导入到我正在处理的 Jupyter 笔记本中,但我似乎无法解决 Folium 库的导入问题。有没有其他人解决过这个问题?
!pip install folium
import pandas as pd
import folium
Output from the above yields:
上述产量的输出:
`ModuleNotFoundError Traceback (most recent call last)
<ipython-input-7-a9938c267a0c> in <module>()
1 get_ipython().system('pip install folium')
2 import pandas as pd
----> 3 import folium
ModuleNotFoundError: No module named 'folium'`
采纳答案by Susma
From the source:
从来源:
Choose the sandbox folder of your choice (~/sandbox for example)
$ mkdir visualization $ cd visualization
Clone folium from github:
$ git clone https://github.com/python-visualization/folium
Run the installation script
$ cd folium $ python setup.py install
选择您选择的沙箱文件夹(例如 ~/sandbox)
$ mkdir visualization $ cd visualization
从 github 克隆 folium:
$ git clone https://github.com/python-visualization/folium
运行安装脚本
$ cd folium $ python setup.py install
回答by ssp
It is not available via default conda channel. Try using conda-forge channel to install folium as show below:
它不能通过默认的 conda 通道使用。尝试使用 conda-forge 频道安装 folium,如下所示:
conda install -c conda-forge folium
回答by Prem Ukkoji
I solved the same problem by executing following command
我通过执行以下命令解决了同样的问题
python3 -m pip install folium
回答by ken
Yes - I had the same issue @Tyler Russell. I eventually git-cloned the github repositories for folium and jinja2 into a file and it worked.
是的 - 我有同样的问题@Tyler Russell。我最终将 folium 和 jinja2 的 github 存储库 git 克隆到一个文件中,并且它起作用了。
Specifically, on my computer, I changed into the right directory from the Command Line Interface with:
具体来说,在我的电脑上,我从命令行界面切换到正确的目录:
$ cd C:\programdata\anaconda3\lib\site_packages
And then typed:
然后输入:
git clone https://github.com/python-visualization/folium.git
git clone https://github.com/pallets/jinja.git
Then 'import folium' (from within python) worked.
然后'import folium'(从python中)工作。
回答by m_leighty
Had similar issues as the original problem. I installed successfully from the shell but jupyter would not recognize the module. What worked for me was (in the jupyter notebook):
有与原始问题类似的问题。我从 shell 成功安装,但 jupyter 无法识别该模块。对我有用的是(在 jupyter notebook 中):
!pip install folium
!pip 安装 folium
回答by Reaz Mahmood
I had the same problem while installing with pip3.(Macos with python3)
So manually cloning the github repo solved it.
Move to the package folder of python 3
cd /usr/local/lib/python3.6/site-packages/
Then,
git clone https://github.com/python-visualization/folium
cd folium
python setup.py install
我在安装 pip3 时遇到了同样的问题。(Macos with python3)所以手动克隆 github repo 解决了它。
移动到python 3的包文件夹
cd /usr/local/lib/python3.6/site-packages/
然后,
git clone https://github.com/python-visualization/folium
cd folium
python setup.py install
回答by dmbhatti
Make sure to reinstall jupyter in new conda env. From what I was able to tell, it runs the Jupyter from preexisting environments and that jupyter does not have access to the packages of the new environment
确保在新的 conda 环境中重新安装 jupyter。据我所知,它从预先存在的环境中运行 Jupyter,而 jupyter 无法访问新环境的包
回答by Abhimanyu
So for Mac OS with Python 3.x, Anaconda doesn't have the library on its installer by default. You need to clone and manually install 2 two libraries:
因此,对于使用 Python 3.x 的 Mac OS,Anaconda 默认情况下在其安装程序中没有该库。您需要克隆并手动安装 2 个两个库:
1) Navigate to /Users/<username>/anaconda3/lib/python3.6/site-packages
1) 导航到 /Users/<username>/anaconda3/lib/python3.6/site-packages
2)Folium
2)大叶
git clone https://github.com/python-visualization/folium.git
git clone https://github.com/python-visualization/folium.git
cd folium
cd folium
python setup.py install
python setup.py install
3)Branca (This library is a spinoff from folium, that would host the non-map-specific features, if importing folium without branca the kernel complains about missing module named branca)
3)Branca(这个库是从 folium 衍生出来的,它将承载非地图特定的功能,如果在没有 branca 的情况下导入 folium,内核会抱怨缺少名为 branca 的模块)
git clone https://github.com/python-visualization/branca.git
git clone https://github.com/python-visualization/branca.git
cd branca
cd branca
python setup.py install
python setup.py install
4)Restart your kernel
4)重启你的内核
5)Import
5)进口
import folium
import folium
import branca
import branca
回答by user3444999
I am using windows 10. I was getting same issue. This is how I fixed it.
我正在使用 Windows 10。我遇到了同样的问题。这就是我修复它的方式。
Open Command prompt, run as administrator.
打开命令提示符,以管理员身份运行。
type "python" to check if python is installed, if not install python globally.
输入“python”以检查是否安装了python,如果没有全局安装python。
if python is installed, you will see python prompt, Ctrl+Z to exit and Run :
如果安装了 python,你会看到 python 提示,Ctrl+Z 退出并运行:
python -m pip install folium
回答by Susma
Below mention command execute in your root working environment.
下面提到的命令在您的根工作环境中执行。
solution 1:
解决方案1:
pip install folium
pip 安装 folium
or
或者
pip3 install folium
pip3 安装大叶
solution 2:
解决方案2:
conda install branca conda install folium
康达安装布兰卡康达安装大叶