Shapely 1.8.5 中文文档

  1. 主页
  2. 文档
  3. Shapely 1.8.5 中文文档
  4. The Project(Shapely)
  5. Installing Shapely(安装Shapely)

Installing Shapely(安装Shapely)

Shapely may be installed from a source distribution or one of several kinds of built distribution.

Shapely可以从source distribution或几种built distribution中的一种安装。

Python 的包分为两种,Built Distribution 和 Source Distribution。

简单来讲,不同操作系统安装 Python 包的要求不完全相同,Built Distribution 是按照某类操作系统(例如 Linux)安装要求所打成的包,这样安装的时候只需要将包解压,文件放到适当的位置即可,效率比较高。但一个 Built Distribution 只适用于一类操作系统,例如 Linux 上的 Built Distribution 包无法在 Windows 上安装。而 Source Distribution 包便解决了这个问题,它是对源代码进行打包,将源代码打包成利于打成 Built Distribution 包的形式。这样,我们便可以通过 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
标签 ,
这篇文章对您有用吗?

我们要如何帮助您?

欢迎留下您的宝贵建议

Please enter your comment!
Please enter your name here