由于 branca 错误,无法使用 Python 2.7 在 Linux Mint 上安装 folium
Can't install folium on Linux Mint with Python 2.7 because of error with branca
我正在尝试在我的 Linux 机器上安装 folium,它有 Python2.7 但我一直收到依赖包 branca 的错误(从终端复制粘贴,如果我也尝试安装 folium,我已经完成了 --no-cache-dir 所以你可以看到错误是相同的,即使我不使用现在缓存在我机器上的一个 pip):
user@linux_mint ~/Desktop/map $ pip install branca --no-cache-dir
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
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
Defaulting to user installation because normal site-packages is not writeable
Collecting branca
Downloading branca-0.4.0.tar.gz (41 kB)
|████████████████████████████████| 41 kB 263 kB/s
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gK2ddq/branca/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gK2ddq/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 /tmp/pip-install-gK2ddq/branca/pip-egg-info
cwd: /tmp/pip-install-gK2ddq/branca/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-gK2ddq/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.
这里有什么问题?是因为我不能将 branca 与 Python 2.7 一起使用,如果我想使用 folium,我需要升级到 3.x?
或者有什么方法可以将 folium 与 Python2.7 一起使用?
我在我的机器上使用了很多 2.7 Python,所以如果可以避免,我真的不想升级。我是一个业余爱好者,这是一个小的副项目,所以如果我能避免进入 3.x 的时间更长一点,我愿意(恕我直言,请不要告诉我为什么这很糟糕,除非它是相关的让 folium 继续......这不是我的问题,我知道 Python 2.7 正在成为历史......我的问题真的只是如何在 Python 2.7 机器上安装 branca 和 folium最小的大惊小怪)。
我只是想制作一些地图:)
谢谢。
编辑:
user@linux_mint ~/Desktop/map $ python -V
Python 2.7.12
user@linux_mint ~/Desktop/map $ pip -V
pip 20.0.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
github 上的 branca 存储库包含一个名为 "drop py2k" 的 commit,它从应用程序中删除了支持 Python2 的代码。在删除的代码中有这个 ImportError
:
if sys.version_info < (3, 0):
raise ImportError(
"""You are running branca {} on Python 2
branca 0.4 and above are no longer compatible with Python 2, but somehow
you got this version anyway. Make sure you have pip >= 9.0 to avoid this
kind of issue, as well as setuptools >= 24.2:
$ pip install pip setuptools --upgrade
Your choices:
- Upgrade to Python 3.
- Install an older version of branca:
$ pip install 'branca<0.4.0'
""".format(__version__)) # noqa
所以安装的时候需要指定一个更早的版本,像这样:
pip install branca<0.4.0
我正在尝试在我的 Linux 机器上安装 folium,它有 Python2.7 但我一直收到依赖包 branca 的错误(从终端复制粘贴,如果我也尝试安装 folium,我已经完成了 --no-cache-dir 所以你可以看到错误是相同的,即使我不使用现在缓存在我机器上的一个 pip):
user@linux_mint ~/Desktop/map $ pip install branca --no-cache-dir
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/__init__.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
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
Defaulting to user installation because normal site-packages is not writeable
Collecting branca
Downloading branca-0.4.0.tar.gz (41 kB)
|████████████████████████████████| 41 kB 263 kB/s
ERROR: Command errored out with exit status 1:
command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-gK2ddq/branca/setup.py'"'"'; __file__='"'"'/tmp/pip-install-gK2ddq/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 /tmp/pip-install-gK2ddq/branca/pip-egg-info
cwd: /tmp/pip-install-gK2ddq/branca/
Complete output (6 lines):
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-install-gK2ddq/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.
这里有什么问题?是因为我不能将 branca 与 Python 2.7 一起使用,如果我想使用 folium,我需要升级到 3.x?
或者有什么方法可以将 folium 与 Python2.7 一起使用?
我在我的机器上使用了很多 2.7 Python,所以如果可以避免,我真的不想升级。我是一个业余爱好者,这是一个小的副项目,所以如果我能避免进入 3.x 的时间更长一点,我愿意(恕我直言,请不要告诉我为什么这很糟糕,除非它是相关的让 folium 继续......这不是我的问题,我知道 Python 2.7 正在成为历史......我的问题真的只是如何在 Python 2.7 机器上安装 branca 和 folium最小的大惊小怪)。
我只是想制作一些地图:)
谢谢。
编辑:
user@linux_mint ~/Desktop/map $ python -V
Python 2.7.12
user@linux_mint ~/Desktop/map $ pip -V
pip 20.0.2 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
github 上的 branca 存储库包含一个名为 "drop py2k" 的 commit,它从应用程序中删除了支持 Python2 的代码。在删除的代码中有这个 ImportError
:
if sys.version_info < (3, 0):
raise ImportError(
"""You are running branca {} on Python 2
branca 0.4 and above are no longer compatible with Python 2, but somehow
you got this version anyway. Make sure you have pip >= 9.0 to avoid this
kind of issue, as well as setuptools >= 24.2:
$ pip install pip setuptools --upgrade
Your choices:
- Upgrade to Python 3.
- Install an older version of branca:
$ pip install 'branca<0.4.0'
""".format(__version__)) # noqa
所以安装的时候需要指定一个更早的版本,像这样:
pip install branca<0.4.0