Shapely may be installed from a source distribution or one of several kinds of built distribution.
Shapely可以从source distribution或几种built distribution中的一种安装。
Built distributions:
Built distributions are the only option for users who do not have or do not know how to use their platform’s compiler and Python SDK, and a good option for users who would rather not bother.
对于没有或不知道如何使用其平台的编译器和Python SDK的用户来说,Built distributions是唯一的选择。对于那些想省事的用户来说,也是一个不错的选择。
Linux, OS X, and Windows users can get Shapely wheels with GEOS included from the Python Package Index with a recent version of pip (8+):
Linux、OS X和Windows用户可以通过pip(8+)从Python软件包索引中获得包含GEOS的Shapely wheel文件。
pip install shapely
Shapely is available via system package management tools like apt, yum, and Homebrew, and is also provided by popular Python distributions like Canopy and Anaconda. If you use the Conda package manager to install Shapely, be sure to use the conda-forge channel.
Shapely可以通过系统软件包管理工具(如apt、yum和Homebrew)获得,也可以由流行的Python发行版(如Canopy和Anaconda)提供。如果你使用Conda软件包管理器来安装Shapely,请务必使用conda-forge channel。
Windows users have another good installation options: the wheels published at https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely. These can be installed using pip by specifying the entire URL.
Windows用户还有一个很好的安装选择:可以通过指定整个URL用pip来安装发布在https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely上的wheel文件。
Source distributions:
If you want to build Shapely from source for compatibility with other modules that depend on GEOS (such as cartopy or osgeo.ogr) or want to use a different version of GEOS than the one included in the project wheels you should first install the GEOS library, Cython, and Numpy on your system (using apt, yum, brew, or other means) and then direct pip to ignore the binary wheels.
如果你想从源码构建Shapely,以便与其他依赖GEOS的模块(cartopy或osgeo.ogr)兼容,或者想使用与项目轮子中包含的GEOS不同的版本,你应该首先在系统中安装GEOS库、Cython和Numpy(使用apt、yum、brew或其他方式),然后指示pip忽略二进制轮子。
pip install shapely --no-binary shapely
If you’ve installed GEOS to a standard location, the geos-config program will be used to get compiler and linker options. If geos-config is not on your executable, it can be specified with a GEOS_CONFIG environment variable, e.g.:
如果你已经把GEOS安装到一个标准位置,geos-config程序将被用来获取编译器和链接器的选项。如果geos-config不在你的可执行文件上,可以用GEOS_CONFIG环境变量来指定它,例如:
GEOS_CONFIG=/path/to/geos-config pip install shapely