在 Windows 上 pip 安装 geopandas

Rob*_*sta 2 python windows pip geopandas

我对 python 比较陌生,并尝试使用 pip 在 python 3.7 上安装 geopandas。出于不同的原因,我想避免使用 anaconda 发行版。在这篇文章之后,我能够通过首先手动安装依赖项来成功安装 geopandas。问题是现在我在尝试导入 geopandas 时遇到了一个问题:

import geopandas
Run Code Online (Sandbox Code Playgroud)

随后的错误消息是:

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\geopandas\__init__.py", line 5, in <module>
from geopandas.io.file import read_file

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\geopandas\io\file.py", line 4, in <module>
import fiona

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fiona\__init__.py", line 87, in <module>
from fiona.collection import BytesCollection, Collection

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fiona\collection.py", line 9, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator

ImportError: DLL load failed: The specified module could not be found.
Run Code Online (Sandbox Code Playgroud)

任何建议将不胜感激

Har*_*rry 13

我的情况和你的差不多。这是我如何设置我的:

平台:Windows 10,64 位 Python 版本:Python 3.7

依赖项(需要 whl 文件):

  1. GDAL?3.0.4?cp37?cp37m?win_amd64.whl
  2. 菲奥娜?1.8.13?cp37?cp37m?win_amd64.whl
  3. pyproj?2.6.0?cp37?cp37m?win_amd64.whl
  4. Rtree?0.9.4?cp37?cp37m?win_amd64.whl

步骤

  1. 下载与平台和 Python 版本匹配的文件

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

  2. 安装包(坚持顺序)

a) C:\Users...\Python37\Scripts>pip3.7 install C:...\GDAL?3.0.4?cp37?cp37m?win_amd64.whl

b) C:\Users...\Python37\Scripts>pip3.7 install C:...\Fiona?1.8.13?cp37?cp37m?win_amd64.whl

c) C:\Users...\Python37\Scripts>pip3.7 install C:...\pyproj?2.6.0?cp37?cp37m?win_amd64.whl

d) C:\Users...\Python37\Scripts>pip3.7 install C:...\Rtree?0.9.4?cp37?cp37m?win_amd64.whl

  1. 鉴于没有错误,现在可以开始了:

C:\Users...\Python37\Scripts>pip3.7.exe 安装 geopandas

  1. 使用 IDEL 3.7.4 进行测试

    导入 geopandas 作为 pdg

(有用!)

这对我有用,我希望这对你也有帮助。

  • 我在安装 GDAL 时遇到了问题,但是 `.whl` 文件帮助了我。https://gis.stackexchange.com/questions/343835/installing-rasterio-and-gdal-api-in-a-virtuallenv-in-windows-10/371720#371720 (2认同)