Python|安装geopandas教程——以四个依赖包为例

Python|geopandas包安装教程

通过geopandas分析json文件更方便快捷。本教程适用于无法通过一键“pip install geopandas”来安装geopandas包的情况。

安装步骤

1.安装4个依赖包

(1)在以下网站上找到需要安装的四个依赖包:shapely、pyproj、gdal、fiona,根据自己python的版本选择适合你的版本:

https://www.lfd.uci.edu/~gohlke/pythonlibs/

(2)打开cmd或者anaconda prompt,用“pip install”依次安装gdal、Fiona、Pyproj、shapely

PS:如果下载的版本和机型不匹配的话会弹出以下ERROR:
代码如下(示例):

C:\Users\dell>pip install C:\Users\dell\Desktop\杂七杂八临时文件\GDAL-3.2.1-cp38-cp38-win_amd64.whl
ERROR: GDAL-3.2.1-cp38-cp38-win_amd64.whl is not a supported wheel on this platform.

再重新下载其他版本即可。
(3)四个依赖包安装成功:
代码如下(示例):

C:\Users\dell>pip install C:\Users\dell\Desktop\geopandas\GDAL-3.3.3-cp39-cp39-win_amd64.whl
Processing c:\users\dell\desktop\geopandas\gdal-3.3.3-cp39-cp39-win_amd64.whl
Installing collected packages: GDAL
Successfully installed GDAL-3.3.3

C:\Users\dell>pip install C:\Users\dell\Desktop\geopandas\Fiona-1.8.20-cp39-cp39-win_amd64.whl
Processing c:\users\dell\desktop\geopandas\fiona-1.8.20-cp39-cp39-win_amd64.whl
Collecting click-plugins>=1.0
  Using cached click_plugins-1.1.1-py2.py3-none-any.whl (7.5 kB)
Collecting cligj>=0.5
  Downloading cligj-0.7.2-py3-none-any.whl (7.1 kB)
Requirement already satisfied: setuptools in c:\users\dell\anaconda3\lib\site-packages (from Fiona==1.8.20) (58.0.4)
Collecting munch
  Using cached munch-2.5.0-py2.py3-none-any.whl (10 kB)
Requirement already satisfied: certifi in c:\users\dell\anaconda3\lib\site-packages (from Fiona==1.8.20) (2021.10.8)
Requirement already satisfied: click>=4.0 in c:\users\dell\anaconda3\lib\site-packages (from Fiona==1.8.20) (8.0.3)
Requirement already satisfied: attrs>=17 in c:\users\dell\anaconda3\lib\site-packages (from Fiona==1.8.20) (21.2.0)
Requirement already satisfied: gdal~=3.3.0 in c:\users\dell\anaconda3\lib\site-packages (from Fiona==1.8.20) (3.3.3)
Requirement already satisfied: six>=1.7 in c:\users\dell\anaconda3\lib\site-packages (from Fiona==1.8.20) (1.16.0)
Requirement already satisfied: colorama in c:\users\dell\anaconda3\lib\site-packages (from click>=4.0->Fiona==1.8.20) (0.4.4)
Installing collected packages: munch, cligj, click-plugins, Fiona
Successfully installed Fiona-1.8.20 click-plugins-1.1.1 cligj-0.7.2 munch-2.5.0

C:\Users\dell>pip install C:\Users\dell\Desktop\geopandas\pyproj-3.3.0-cp39-cp39-win_amd64.whl
Processing c:\users\dell\desktop\geopandas\pyproj-3.3.0-cp39-cp39-win_amd64.whl
Requirement already satisfied: certifi in c:\users\dell\anaconda3\lib\site-packages (from pyproj==3.3.0) (2021.10.8)
Installing collected packages: pyproj
Successfully installed pyproj-3.3.0

C:\Users\dell>pip install C:\Users\dell\Desktop\geopandas\Shapely-1.8.0-cp39-cp39-win_amd64.whl
Processing c:\users\dell\desktop\geopandas\shapely-1.8.0-cp39-cp39-win_amd64.whl
Installing collected packages: Shapely
Successfully installed Shapely-1.8.0 

有的教程还会教你再安装一个Rtree包,这个看个人情况,没装的话可以装一个。


2.安装geopandas包

很简单,就一句:pip install geopandas,然后等待几秒,显示successfully installed geopandas即可。

C:\Users\dell>pip install geopandas
Collecting geopandas
  Downloading geopandas-0.10.2-py2.py3-none-any.whl (1.0 MB)
     |████████████████████████████████| 1.0 MB 327 kB/s
Requirement already satisfied: fiona>=1.8 in c:\users\dell\anaconda3\lib\site-packages (from geopandas) (1.8.20)
Requirement already satisfied: pandas>=0.25.0 in c:\users\dell\anaconda3\lib\site-packages (from geopandas) (1.3.4)
Requirement already satisfied: shapely>=1.6 in c:\users\dell\anaconda3\lib\site-packages (from geopandas) (1.8.0)
Requirement already satisfied: pyproj>=2.2.0 in c:\users\dell\anaconda3\lib\site-packages (from geopandas) (3.3.0)
Requirement already satisfied: certifi in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (2021.10.8)
Requirement already satisfied: setuptools in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (58.0.4)
Requirement already satisfied: gdal~=3.3.0 in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (3.3.3)
Requirement already satisfied: attrs>=17 in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (21.2.0)
Requirement already satisfied: cligj>=0.5 in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (0.7.2)
Requirement already satisfied: six>=1.7 in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (1.16.0)
Requirement already satisfied: click-plugins>=1.0 in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (1.1.1)
Requirement already satisfied: munch in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (2.5.0)
Requirement already satisfied: click>=4.0 in c:\users\dell\anaconda3\lib\site-packages (from fiona>=1.8->geopandas) (8.0.3)
Requirement already satisfied: colorama in c:\users\dell\anaconda3\lib\site-packages (from click>=4.0->fiona>=1.8->geopandas) (0.4.4)
Requirement already satisfied: numpy>=1.17.3 in c:\users\dell\anaconda3\lib\site-packages (from pandas>=0.25.0->geopandas) (1.20.3)
Requirement already satisfied: pytz>=2017.3 in c:\users\dell\anaconda3\lib\site-packages (from pandas>=0.25.0->geopandas) (2021.3)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\dell\anaconda3\lib\site-packages (from pandas>=0.25.0->geopandas) (2.8.2)
Installing collected packages: geopandas
Successfully installed geopandas-0.10.2

嗯嗯,搞定啦!!!

来源:_超快的闪电

物联沃分享整理
物联沃-IOTWORD物联网 » Python|安装geopandas教程——以四个依赖包为例

发表评论