windows环境下安装Python的Rtree包

时间:2022-12-22 04:01:32

Rtree包是基于libspatialindex开发的,在安装Rtree之前必须先安装libspatialindex。关于libspatialindex,除了官网的英文外,这里有一个中文翻译过来的介绍:http://blog.csdn.net/ljz2173/article/details/46009573,不再多说。

1. 这里 http://www.lfd.uci.edu/~gohlke/pythonlibs/#rtree 下载对应版本的Rtree的whl安装包,注意是python2.7还是3.5,注意电脑是32还是64位。可以放在电脑任意位置

2. 确保电脑里已经安装了python中wheel这个包,没有的话这个可以直接在cmd中输入pip install wheel安装

3. 打开cmd,输入pip install E:\软件安装包\Rtree-0.8.2-cp35-cp35m-win_amd64.whl,这个E盘是我存放Rtree的whl安装包的位置,自己安装的时候根据具体情况改一下即可。

windows环境下安装Python的Rtree包

顺便啰嗦一句吧,Linux安装libspatialindex的步骤大概如下:

https://github.com/libspatialindex/libspatialindex/wiki/1.-Getting-Started

鉴于国内github可能被墙,顺便也贴过来吧:

This tutorial will help you to get started with libspatialindex using C++ on linux. The following code is run on Ubuntu 12. If you are using windows the installation may be different. First install some prerequisites please enter the following into terminal. You may very well already have these installed.

windows环境下安装Python的Rtree包

Now we download and install the library. It doesn't matter what directory you download this in. Please note the version number, you can check if there are more recent versions in the download page here http://download.osgeo.org/libspatialindex/ . Now enter the following into your terminal:

windows环境下安装Python的Rtree包

libspatialindex should now be installed on your system. Let's try to make a small c++ program to test this. Create the file tutorial1.cpp somewhere and enter the following:

windows环境下安装Python的Rtree包

Now let's compile the code. Type the following into the console. Please note -std=c++0x makes it compile into C++11, although not required here it will be used in later examples.

windows环境下安装Python的Rtree包

Now run the program:

windows环境下安装Python的Rtree包

and it should output the following:

windows环境下安装Python的Rtree包