Basmap

Basmap

0. Install

教程推薦:

  1. 官方文檔
  2. moxigandashu 2017
  3. 往下看我的(系統:Deepin 15.11)

1. Dependency:

  • python
  • pip install:
    • Matplotlib
    • NumPy
    • GeobricksProj4ToEPSG
    • pyproj
    • pyshp
  • geos
    sudo apt install libgeos-3.6.2
    sudo apt install libgeos-dev

Install from the source

Release:WeatherGod
百度網盤: 2tue

mkdir Basemap
cd Basmap
wget -c https://github.com/matplotlib/basemap/archive/v1.1.0.tar.gz
## ummmmm... 126m, 我下載的時候... 有點大, 優點慢, 自己想辦法把
## 給個百度雲鏈接把,我。 100kb,總比50kb的瀏覽器速度要好把
tar -zxvf basemap-1.1.0.tar.gz
cd basemap-1.1.0
cd geos-3.3.3
export GEOS_DIR=$(pwd)
./configure --prefix=$GEOS_DIR
make; make install

報錯

../../../include/geos/geom/Coordinate.inl:39:10: error: 'ISNAN' was not declared in this scope
return (ISNAN(x) && ISNAN(y) && ISNAN(z));

解決: VeRo
找到platform.h把24行的/* #undef HAVE_ISNAN */替換成: #define HAVE_ISNAN 1 ("#"號不能丟)
我直接用sed替換了:

sed -i 's=/\* #undef HAVE_ISNAN \*/=#define HAVE_ISNAN 1=' ./include/geos/platform.h

make 要蠻久, 慢慢等把

sudo make install 以後, 退到上一級目錄

python setup.py install

又報錯:

src/_geoslib.c:5552:21: error: ‘PyThreadState {aka struct _ts}’ has no member named ‘exc_type’; did you mean ‘curexc_type’?

sudo pip3.7 install cpython

更具jonathanunderwood在github帖子中的解釋, 是應爲python3.7不適配的原因。我直接用python2.7安裝成功了。 不過,後面在導入包的時候,又有function問題- -我放棄了 嘿嘿嘿

還是用leaft把

Author

Karobben

Posted on

2020-01-22

Updated on

2024-01-22

Licensed under

Comments