导入django.contrib.gis.gdal时出现Geodjango异常:OSError:/usr/lib/libgdal.so.1:未定义的符号:sqlite3_column_table_name [英] Geodjango Exception when importing django.contrib.gis.gdal: OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

查看:480
本文介绍了导入django.contrib.gis.gdal时出现Geodjango异常:OSError:/usr/lib/libgdal.so.1:未定义的符号:sqlite3_column_table_name的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已遵循教程在我的Ubuntu 14.04上安装Geodjango.我正在使用Django 1.10和Python 3.5,postgres-9.6和postgis 2.3.

I have followed the tutorial for installing Geodjango on my Ubuntu 14.04. I am using Django 1.10 and Python 3.5, postgres-9.6 and postgis 2.3.

我已检查 此处,但发现了没有解决方案. 在新安装的ubuntu 14.04虚拟机中,它可以正常工作.

I have checked here and here, but found no solution. In a newly installed ubuntu 14.04 Virtual Machine, it worked.

但是在我的安装中,当我尝试进行迁移时,我得到了: OSError:/usr/lib/libgdal.so.1:未定义的符号:sqlite3_column_table_name

But in my installation, when I tried making migrations, I got: OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

进一步调查一下,我尝试了一下:

Investigating a bit further, I tried simply:

from django.contrib.gis import gdal

得到了:

Traceback (most recent call last):   
File "<stdin>", line 1, in <module>   
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/__init__.py", line 49, in <module>
    from django.contrib.gis.gdal.driver import Driver  # NOQA   
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/driver.py", line 5, in <module>
    from django.contrib.gis.gdal.prototypes import ds as vcapi, raster as rcapi   
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/prototypes/ds.py", line 9, in <module>
    from django.contrib.gis.gdal.libgdal import GDAL_VERSION, lgdal   
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/site-packages/django/contrib/gis/gdal/libgdal.py", line 48, in <module>
    lgdal = CDLL(lib_path)   
File "/home/pv/anaconda3/envs/dj110py35/lib/python3.5/ctypes/__init__.py", line 347, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: /usr/lib/libgdal.so.1: undefined symbol: sqlite3_column_table_name

关于如何修复我的设置有什么建议吗?

Is there any suggestions on how I could repair my setup?

我的conda环境似乎有问题.当我开始使用pip virtualenv时,此问题不再出现.我没有回答这个问题,因为我找不到解决方案,只是一种解决方法.但是使用pip virtualenv重建环境是可行的.

It seems to be a problema with my conda environment. When I started using a pip virtualenv, the problem did not arise anymore. I am not answering the question, because I could not find the solution, only a workaround. But rebuilding the environment with pip virtualenv works.

推荐答案

在conda环境中:conda install -c conda-forge gdal=2.2.1

In conda environment: conda install -c conda-forge gdal=2.2.1

在Django settings.py中: GDAL_LIBRARY_PATH = '<HOME>/anaconda3/envs/<env_name>/lib/libgdal.so'

In django settings.py: GDAL_LIBRARY_PATH = '<HOME>/anaconda3/envs/<env_name>/lib/libgdal.so'

这篇关于导入django.contrib.gis.gdal时出现Geodjango异常:OSError:/usr/lib/libgdal.so.1:未定义的符号:sqlite3_column_table_name的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆