好不容易在电脑上开发完Application上线的时候,发现有一堆库没有装。。。
首先还是报了个
File "/home/www/nx2/nx2/nx/models.py", line 6, in <module>
from django.contrib.gis.geos import Point
ImportError: cannot import name Point
然后中间还有
File "/home/www/nx2/local/lib/python2.7/dist-packages/django/contrib/gis/geos/__init__.py", line 7, in <module>
from .libgeos import geos_version, geos_version_info, GEOS_PREPARE
File "/home/www/nx2/local/lib/python2.7/dist-packages/django/contrib/gis/geos/libgeos.py", line 58, in <module>
lgeos = CDLL(lib_path)
File "/usr/lib64/python2.7/ctypes/__init__.py", line 360, in __init__
self._handle = _dlopen(self._name, mode)
接着网上找了个教程,在AWS上安装Geo的教程:
yum install postgresql-libs postgresql postgresql-server postgresql-devel
sudo yum install gcc make gcc-c++ libtool libxml2-devel
接着我们需要编译下面这些软件
geos-3.3.5
proj-4.8.0
gdal-1.9.1
postgis-2.0.1
编译过程
cd /usr/local/src
wget http://download.osgeo.org/geos/geos-3.3.5.tar.bz2
tar xjf geos-3.3.5.tar.bz2
cd geos-3.3.5
./configure
make
sudo make install
# download, configure, make, install proj
wget http://download.osgeo.org/proj/proj-4.8.0.tar.gz
wget http://download.osgeo.org/proj/proj-datumgrid-1.5.zip
tar xzf proj-4.8.0.tar.gz
cd proj-4.8.0/nad
unzip ../../proj-datumgrid-1.5.zip
cd ..
./configure
make
sudo make install
# gdal, you may need to install svn (yum install svn)
svn checkout https://svn.osgeo.org/gdal/trunk/gdal gdal
cd gdal
./configure --with-python
make
sudo make install
# download, configure, make, install postgis
wget http://postgis.refractions.net/download/postgis-2.0.1.tar.gz
tar xzf postgis-2.0.1.tar.gz
cd postgis-2.0.1
./configure --with-geosconfig=/usr/local/bin/geos-config
make
sudo make install
最后,记得更新库
sudo -i
echo /usr/local/lib > /etc/ld.so.conf.d/postgis.conf # assumes your /etc/ld.so.conf loads all /etc/ld.so.conf.d/*.conf
ldconfig
exit
接着我们就可以愉快地使用Elastic Search + Django
围观我的Github Idea墙, 也许,你会遇到心仪的项目