简体   繁体   English

如何使用pip在Windows 10上安装Geopandas

[英]How to Install Geopandas on Windows 10 Using pip

为了使工作解决方案在Stack Overflow上得到接受,并尽可能多地提供有关在Windows 10上使用pip使用pip安装Geopandas或依赖于该软件包的OSMnx之类的软件包的问题的信息,我将发布工作流程下面

Three possible problems and they have to do with the difference between pip and conda discussed here 三个可能的问题,它们与此处讨论的pip和conda之间的区别有关

First, pip requires Visual C++ to compile packages, while conda does not. 首先,pip需要Visual C ++来编译软件包,而conda则不需要。

The easiest way to ensure that you have Visual C++ available is to install the community distribution of Visual Studio . 确保您拥有Visual C ++的最简单方法是安装Visual Studio的社区发行版。 Depending on the options selected this is potentially several gbs so a good internet connection helps a lot. 根据选择的选项,这可能是几个gb,因此良好的Internet连接很有帮助。

Second, use pip to install the wheels of GDAL version 2.4 not 3.0, Fiona Shapely and possibly Rtree . 其次,使用pip安装GDAL版本2.4的轮子而不是3.0, Fiona Shapely以及可能的Rtree These can be found here . 这些可以在这里找到。

If you have GDAL already installed via OSGeoW64 you'll need to uninstall that by deleteing the entire OSGEo4w folder in the C: drive 如果您已经通过OSGeoW64安装了GDAL,则需要通过删除C:驱动器中的整个OSGEo4w文件夹来卸载它

Pick the version for the architecture of python that you have installed, NOT the architecture of your computer. 选择已安装的python体系结构的版本,而不是计算机的体系结构。 Check using this clever line that offers an indication of what the difference between architectures actually is. 使用这条巧妙的线进行检查, 该线可以指示出架构之间的实际差异。

import struct;print(struct.calcsize("P") * 8 )

Finally, you may need to set environmental variables . 最后,您可能需要设置环境变量 It's important to know that gdal-config and GDAL_CONFIG are specific to linux based OS's and for windows, you're looking for GDAL_VERSION and GDAL_DATA . 重要的是要知道gdal-configGDAL_CONFIG特定于基于Linux的OS,对于Windows,您正在寻找GDAL_VERSIONGDAL_DATA

Be sure to pip uninstall <package> before installing from a wheel or otherwise, and be sure to actually import the packages before assuming that they have installed correctly, even if there weren't any error messages upon pip install 在从轮子或其他方式安装之前,请务必先pip uninstall <package> ,并且即使在pip install时未出现任何错误消息,也要确保在正确安装之前先导入软件包。

Lastly, there is a lot of helpful info already out there but not collected in a sinlge place so if there's something missing of course edit the answer to include. 最后,已经有很多有用的信息,但是没有收集在一个单一的地方,因此,如果缺少某些内容,请编辑答案以使其包括在内。

edit: just tried this with a python environement using the 64bit version of python 3.7.4 and it also worked. 编辑:刚刚尝试使用python 3.7.4的64位版本的python环境,它也可以工作。

One note, initially, the install failed, OSError: could not find or load spatialindex_c.dll 需要注意的是,最初,安装失败, OSError: could not find or load spatialindex_c.dll

To solve this and possibly other errors, pip uninstall and pip install the wheels for numpy GDAL Rtree Shapely and Fiona a second time. 要解决此错误以及其他可能的错误, pip install Rtree进行pip uninstallpip installnumpy GDAL Rtree ShapelyFiona pip install轮子。 Either I did not install them in the correct order initially or their is a circular dependency that installing everything twice resolves. 最初我没有按照正确的顺序安装它们,或者它们是循环依赖项,因此安装所有内容都会解决两次。

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

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