简体   繁体   中英

Import GDAL Python failed

I'm using linux x64 and install GDAL with easy install

sudo easy_install GDAL

Checking GDAL :

reigin@reigin-K43SA:~/pyton$ gdalinfo --version
GDAL 1.10.1, released 2013/08/26

But when i use import :

>>> import gdal
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named gdal

My python path :

>>> import sys
>>> sys.path
['', '/home/reigin/miniconda2/lib/python27.zip', '/home/reigin/miniconda2/lib/python2.7', '/home/reigin/miniconda2/lib/python2.7/plat-linux2', '/home/reigin/miniconda2/lib/python2.7/lib-tk', '/home/reigin/miniconda2/lib/python2.7/lib-old', '/home/reigin/miniconda2/lib/python2.7/lib-dynload', '/home/reigin/miniconda2/lib/python2.7/site-packages', '/home/reigin/miniconda2/lib/python2.7/site-packages/setuptools-34.3.2-py2.7.egg']

I try : can't import gdal in python? and http://trac.osgeo.org/gdal/wiki/GdalOgrInPython but idk how to implement this, cz i'm new in python..

any help thanks alot..

Looks like you are using conda , so try using the conda installer which will also install the GDAL binaries:

conda install -c conda-forge gdal

I believe easy_install only installs the python bindings. You also need the correct C++ binaries available.

If you are importing gdal installed with conda you should import gdal like this. from osgeo import gdal

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM