Install Spatialite for python (GeoDjango) on OS X

前端 未结 3 1778
南方客
南方客 2021-01-12 00:25

I am tearing my hair out trying to install Spatialite for GeoDjango!

I am already using Homebrew, it\'s generally easy and convenient so I initially tried to follow

3条回答
  •  暖寄归人
    2021-01-12 01:07

    When I was istalling this i follow this instructions https://docs.djangoproject.com/en/dev/ref/contrib/gis/install/spatialite/#pysqlite2

    pysqlite2

    If you’ve decided to use a newer version of pysqlite2 instead of the sqlite3 Python stdlib module, then you need to make sure it can load external extensions (i.e. the required enable_load_extension method is available so SpatiaLite can be loaded).

    This might involve building it yourself. For this, download pysqlite2 2.6, and untar:

    $ wget https://pypi.python.org/packages/source/p/pysqlite/pysqlite-2.6.3.tar.gz
    $ tar xzf pysqlite-2.6.3.tar.gz
    $ cd pysqlite-2.6.3
    

    Next, use a text editor (e.g., emacs or vi) to edit the setup.cfg file to look like the following:

    [build_ext]
    #define=
    include_dirs=/usr/local/include
    library_dirs=/usr/local/lib
    libraries=sqlite3
    #define=SQLITE_OMIT_LOAD_EXTENSION
    

提交回复
热议问题