gpt4 book ai didi

python - Jupyter Notebook 无法打包 folium

转载 作者:行者123 更新时间:2023-12-01 06:20:16 27 4
gpt4 key购买 nike

我尝试将 folium 包安装到 Jupyter Notebook 中。我不得不尝试很多方法,例如添加系统路径、升级pip、安装setuptools,但我无法做到。我的笔记本电脑是 Macbook Pro,系统:Catalina 10.15.3,来自 Anaconda 的 Jupyter Notebook。 Python版本:3.7.4

系统可执行文件:

'/opt/anaconda3/bin/python'

系统路径:

['/Users/scott/Documents/Untitled Folder',
'/opt/anaconda3/lib/python37.zip',
'/opt/anaconda3/lib/python3.7',
'/opt/anaconda3/lib/python3.7/lib-dynload',
'',
'/opt/anaconda3/lib/python3.7/site-packages',
'/opt/anaconda3/lib/python3.7/site-packages/aeosa',
'/opt/anaconda3/lib/python3.7/site-packages/IPython/extensions',
'/Users/scott/.ipython']

我写的代码是:

import numpy as np
import pandas as pd
import collections
import re
import matplotlib.pyplot as plt
import matplotlib
from collections import OrderedDict
from math import ceil
#!python3 -m pip install folium --user
#!python3 -m pip install branca --user
#!python3 -m pip install jinja2 --user
#!python3 -m pip install requests --user
#!pip install --user scipy
#!python -m pip install --upgrade pip
import scipy
#import branca
! pip install --user folium
import tqdm
import folium

但是,我遇到了这样的错误:

DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support
Collecting folium
Using cached folium-0.8.3-py2.py3-none-any.whl (87 kB)
Requirement already satisfied: six in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from folium) (1.12.0)
Collecting jinja2
Using cached Jinja2-2.11.1-py2.py3-none-any.whl (126 kB)
Requirement already satisfied: numpy in /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python (from folium) (1.8.0rc1)
Collecting requests
Using cached requests-2.23.0-py2.py3-none-any.whl (58 kB)
Collecting branca>=0.3.0
Using cached branca-0.4.0.tar.gz (41 kB)
ERROR: Command errored out with exit status 1:
command: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/zm/pks1_crj5d7d7wp4x_4sr5rm0000gn/T/pip-install-r8yciP/branca/setup.py'"'"'; __file__='"'"'/private/var/folders/zm/pks1_crj5d7d7wp4x_4sr5rm0000gn/T/pip-install-r8yciP/branca/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /private/var/folders/zm/pks1_crj5d7d7wp4x_4sr5rm0000gn/T/pip-install-r8yciP/branca/pip-egg-info
cwd: /private/var/folders/zm/pks1_crj5d7d7wp4x_4sr5rm0000gn/T/pip-install-r8yciP/branca/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/private/var/folders/zm/pks1_crj5d7d7wp4x_4sr5rm0000gn/T/pip-install-r8yciP/branca/setup.py", line 41
print(error, file=sys.stderr) # noqa
^
SyntaxError: invalid syntax
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-201-2c07c456259d> in <module>
17 get_ipython().system(' pip install --user folium')
18 import tqdm
---> 19 import folium

ModuleNotFoundError: No module named 'folium'

我对这个错误感到困惑好几天了,有人可以帮助我吗?提前致谢!

最佳答案

看起来您正在尝试在 anaconda 3.7 环境中工作,但您的错误消息提示是 python 2.7 并且提示找不到 folium。

您在 anaconda 3.7 环境之外工作时是否以某种方式 pip install folium 模块?

也许你可以尝试 conda navigator 工具并以这种方式获取 folium 包...

关于python - Jupyter Notebook 无法打包 folium,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60387988/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com