在Ubuntu 18.04上安装带有Python3.6的Basemap

在Ubuntu 18.04上安装带有Python3.6的Basemap,python,matplotlib,Python,Matplotlib,在过去的几个小时里,我一直在努力起床跑步。以下是我的跑步记录: conda在Pycharm上的myvenv中安装basemap。安装按计划进行,我在termal中收到一条消息,说明已安装basemap-1.2.0。运行我的程序时: Downloading and Extracting Packages proj4-5.0.1 | 7.0 MB | #################################################################

在过去的几个小时里,我一直在努力起床跑步。以下是我的跑步记录:

conda在Pycharm上的my
venv
中安装basemap
。安装按计划进行,我在termal中收到一条消息,说明已安装basemap-1.2.0。运行我的程序时:

Downloading and Extracting Packages
proj4-5.0.1          |  7.0 MB | ############################################################################################################################################################################################################################### | 100% 
certifi-2018.10.15   |  139 KB | ############################################################################################################################################################################################################################### | 100% 
libgcc-ng-8.2.0      |  7.6 MB | ############################################################################################################################################################################################################################### | 100% 
libstdcxx-ng-8.2.0   |  2.9 MB | ############################################################################################################################################################################################################################### | 100% 
pyshp-1.2.12         |   35 KB | ############################################################################################################################################################################################################################### | 100% 
pyproj-1.9.5.1       |   64 KB | ############################################################################################################################################################################################################################### | 100% 
openssl-1.0.2p       |  3.5 MB | ############################################################################################################################################################################################################################### | 100% 
conda-4.5.11         |  1.0 MB | ############################################################################################################################################################################################################################### | 100% 
geos-3.6.2           |  1.6 MB | ############################################################################################################################################################################################################################### | 100% 
basemap-1.2.0        | 15.2 MB | ############################################################################################################################################################################################################################### | 100% 
Preparing transaction: done
Verifying transaction: done
Executing transaction: done


 Traceback (most recent call last):
  File "/home/PycharmProjects/first_prog/venv/test.py", line 5, in <module>
    from mpl_toolkits.basemap import Basemap
ModuleNotFoundError: No module named 'mpl_toolkits.basemap'
对于这个错误有几种解决方案,但没有一种有效。我试着用,跟着,试着用,跟着这些,还有更多,但是没有任何效果

是相关的,但错误仍然存在

make
错误相关,但
make:**[所有递归]错误1
仍然存在


我做错了什么?安装Basemap真的这么难吗?我完全被困在这里了,非常感谢您的帮助。

下面的方法应该有效。你可以下载档案


我发现这个脚本适合我。它与另一个答案稍有不同,它下载并安装basemap,而无需单独下载

pip install --upgrade --user matplotlib numpy pyproj pyshp OWSLib Pillow 
sudo apt-get update 
sudo apt install libgeos-dev 
pip install --user https://github.com/matplotlib/basemap/archive/master.zip

我遇到了完全相同的问题:甚至是相同的错误。似乎当我使用更高版本的g++/gcc(~v7.4)来编译较旧版本的geos(~3.3.0)时,出现了这个问题

然后我去获取版本3.8.0的geos,仍然使用普通的gcc/g++,一切都很好


希望这能对你和其他人有所帮助

可能与您的问题无关:我在使用Anaconda安装Basemap时遇到问题,我在设置环境变量时解决了这些问题,在我的例子中,
export PROJ_LIB=…/miniconda3/share/PROJ
Makefile:373: recipe for target 'IndexedPointInAreaLocator.lo' failed
make[4]: *** [IndexedPointInAreaLocator.lo] Error 1
make[4]: Leaving directory '/home/Downloads/basemap-1.0.7/geos-3.3.3/src/algorithm/locate'
Makefile:392: recipe for target 'check-recursive' failed
make[3]: *** [check-recursive] Error 1
make[3]: Leaving directory '/home/Downloads/basemap-1.0.7/geos-3.3.3/src/algorithm/locate'
Makefile:444: recipe for target 'check-recursive' failed
make[2]: *** [check-recursive] Error 1
make[2]: Leaving directory '/home/Downloads/basemap-1.0.7/geos-3.3.3/src/algorithm'
Makefile:476: recipe for target 'check-recursive' failed
make[1]: *** [check-recursive] Error 1
make[1]: Leaving directory '/home/Downloads/basemap-1.0.7/geos-3.3.3/src'
Makefile:368: recipe for target 'check-recursive' failed
make: *** [check-recursive] Error 1
pip install --upgrade --user matplotlib numpy pyproj pyshp OWSLib Pillow
sudo apt install libgeos-dev
pip install --user --upgrade basemap-1.2.0rel.tar.gz
pip install --upgrade --user matplotlib numpy pyproj pyshp OWSLib Pillow 
sudo apt-get update 
sudo apt install libgeos-dev 
pip install --user https://github.com/matplotlib/basemap/archive/master.zip