如何在Ubuntu 16.04上的Python 3 / Matplotlib 2中安装底图?

问题描述 投票:4回答:2

我试过了

pip3 install basemap

Basemap似乎不在PyPI上。

an old question但它没有答案。

我做了什么

  1. 我下载了底图1.07(source
  2. Matplotlib 2,numpy 1.11,PIL,python3-dev已安装

我不知道在哪里/如何获得GEOS(libgeos-dev?)。我想我遵循README并没有显示任何错误,但是在尝试this的第一行时

$ python3
>>> from mpl_toolkits.basemap import Basemap

我明白了

ImportError: libgeos-3.3.3.so: cannot open shared object file: No such file or directory

它在

$ locate libgeos-3.3.3.so
/home/math/Downloads/basemap-1.0.7/geos-3.3.3/src/.libs/libgeos-3.3.3.so
/usr/local/lib/libgeos-3.3.3.so
python-3.x matplotlib ubuntu-16.04 matplotlib-basemap
2个回答
9
投票

在Ubuntu中,这对我有用:

$ sudo apt-get install libgeos-dev
$ pip install --user https://github.com/matplotlib/basemap/archive/master.zip

为了完整起见,如果您知道需要特定版本,可以通过将鼠标悬停在需要here的软件包/版本号上来找到下载链接。例如,如果我需要安装v1.1.0,我可以使用上面的代码,用第二行代替:

$ pip install --user https://github.com/matplotlib/basemap/archive/v1.1.0.zip

0
投票

试试这个:

sudo apt-get install libgeos-dev

sudo pip3 install -U git+https://github.com/matplotlib/basemap.git  # latest Version from Source

旧版本可能与matplotlib不兼容。

© www.soinside.com 2019 - 2024. All rights reserved.