How to install Contextily?

一曲冷凌霜 提交于 2019-12-24 00:47:06

问题


This question is written in relation with the answer to Plotting a map using geopandas and matplotlib.

The main point is that installing (spatial) libraries such as Proj.4 or Contextily can be a confusing task under Windows, so that most of the time we are advised to directly

use the OSGeo4W software distribution.

An example of such an advise here.

A contrario, the task is rather easy with other operating systems.


The main idea is to provide interrogative users with a "lite" installation approach.


回答1:


Using Anaconda / conda

If you are using the Anaconda distribution or in general the conda package manager (which I recommend for installing the python geo stack), it should suffice to install contextily with:

conda install contextily --channel conda-forge

This will automatically install all python and C dependencies (proj.4, GDAL, ...)

This should work on all platforms (Windows, Linux, Mac).




回答2:


Windows

(Without any conda-like distribution)

After manually downloading the WHL files from Unofficial Windows Binaries for Python Extension Packages. Open an Administrator Command Prompt and type (illustrated on Python3.6 32bit):

pip3.6 install Fiona-1.8.4-cp36-cp36m-win32.whl --force-reinstall
pip3.6 install GDAL-2.3.3-cp36-cp36m-win32.whl && setx GDAL_VERSION "2.3.3"
pip3.6 install geopandas-0.4.0-py2.py3-none-any.whl
pip3.6 install proj
pip3.6 install Shapely-1.6.4.post1-cp36-cp36m-win32.whl
pip3.6 install Cartopy-0.17.0-cp36-cp36m-win32.whl
pip3.6 install rasterio-1.0.13-cp36-cp36m-win32.whl
pip3.6 install contextily

(tested).



来源:https://stackoverflow.com/questions/54149384/how-to-install-contextily

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!