简体   繁体   English

在 Windows 上 pip 安装 geopandas

[英]pip install geopandas on windows

I am relatively new to python and trying to install geopandas on python 3.7 using pip.我对 python 比较陌生,并尝试使用 pip 在 python 3.7 上安装 geopandas。 For separate reasons, I would like to avoid using the anaconda distribution.出于不同的原因,我想避免使用 anaconda 发行版。 Following this post , I was able to successfully install geopandas by first installing the dependencies manually.这篇文章之后,我能够通过首先手动安装依赖项来成功安装 geopandas。 The problem is that now I run into a problem when I try to import geopandas:问题是现在我在尝试导入 geopandas 时遇到了一个问题:

import geopandas

The subsequent error message is:随后的错误消息是:

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.

Any advice would be greatly appreciated任何建议将不胜感激

My case is similar to yours.我的情况和你的差不多。 And here is how I got mine setup:这是我如何设置我的:

Platform: Windows 10, 64-bit Python Version: Python 3.7平台:Windows 10,64 位 Python 版本:Python 3.7

Dependencies (whl files needed):依赖项(需要 whl 文件):

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

Steps :步骤

  1. Download the files that match the platform and Python version from下载与平台和 Python 版本匹配的文件

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

  2. Install packages (stick with the order)安装包(坚持顺序)

a) C:\\Users...\\Python37\\Scripts>pip3.7 install C:...\\GDAL‑3.0.4‑cp37‑cp37m‑win_amd64.whl 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 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 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 d) C:\\Users...\\Python37\\Scripts>pip3.7 install C:...\\Rtree‑0.9.4‑cp37‑cp37m‑win_amd64.whl

  1. Given no errros, now it's good to go:鉴于没有错误,现在可以开始了:

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

  1. Test it using IDEL 3.7.4使用 IDEL 3.7.4 进行测试

    import geopandas as pdg导入 geopandas 作为 pdg

(It works!) (有用!)

This works for me and I hope this is also helpful for you.这对我有用,我希望这对你也有帮助。

Possibly duplicate of how to successfully install pyproj and geopandas? 可能重复说明如何成功安装pyproj和geopandas?

我在 (win-64, Spyder3.8, Python3.8.3) 上安装 geopandas 时遇到问题 使用此表达式在 anaconda 提示符下安装 geopandas: conda install -c conda-forge/label/cf202003 geos (不要使用本网站: https: //geopandas.org/install.html )(不要使用这个表达式:conda install --channel conda-forge geopandas)

The simplest method to install geopandas is:安装geopandas的最简单方法是:

conda install geopandas

In order to update geopandas to latest version use the following command after installation by conda :为了更新geopandas到最新版本使用以下的安装后命令conda

pip install geopandas --upgrade 

There are other installation methods also explained in Geopandas official website . Geopandas官网还有其他安装方法也有说明。

Conda is really powerful when it comes to installation as it will install the dependencies needed by the package. Conda 在安装方面非常强大,因为它将安装包所需的依赖项。 However, if you would like to install dependencies earlier than use the following command:但是,如果您想在使用以下命令之前安装依赖项:

conda install pandas fiona shapely pyproj rtree descartes

Note that if you have installed the dependencies using above command then you can also use pip to install geopandas but before installing via pip dependencies are required to be installed.请注意,如果您已经使用上述命令安装了依赖项,那么您也可以使用pip安装geopandas但在通过 pip 安装之前需要安装依赖项。 In order to read more about dependencies, please follow the official guide .为了阅读有关依赖项的更多信息,请遵循官方指南 To install using pip use the following command:要使用pip安装,请使用以下命令:

pip install geopandas

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM