How to install Contextily?

2019-07-15 08:15发布

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.

2条回答
来,给爷笑一个
2楼-- · 2019-07-15 08:41

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).

查看更多
beautiful°
3楼-- · 2019-07-15 08:50

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).

查看更多
登录 后发表回答