问题
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?
!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'`
回答1:
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
回答2:
It is not available via default conda channel. Try using conda-forge channel to install folium as show below:
conda install -c conda-forge folium
回答3:
I solved the same problem by executing following command
python3 -m pip install folium
回答4:
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.
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.
回答5:
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
回答6:
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):
!pip install folium
回答7:
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
回答8:
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:
1) Navigate to /Users/<username>/anaconda3/lib/python3.6/site-packages
2)Folium
git clone https://github.com/python-visualization/folium.git
cd folium
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)
git clone https://github.com/python-visualization/branca.git
cd branca
python setup.py install
4)Restart your kernel
5)Import
import folium
import branca
回答9:
I am using windows 10. I was getting same issue. This is how I fixed it.
Open Command prompt, run as administrator.
type "python" to check if python is installed, if not install python globally.
if python is installed, you will see python prompt, Ctrl+Z to exit and Run :
python -m pip install folium
回答10:
Below mention command execute in your root working environment.
solution 1:
pip install folium
or
pip3 install folium
solution 2:
conda install branca conda install folium
来源:https://stackoverflow.com/questions/44617159/python-3-6-module-cannot-be-found-folium