2013-09-27 72 views
3

我試圖在幾個指南和StackOverflow答案中安裝GDAL ina virstualenvwrapper。python setup.py build_ext --include-dirs =/usr/include/gdal/not work

我在Ubuntu 13.04我istalled ligbdal1libgdal1-dev

裏面我的virtualenv我試過:

pip install --no-install GDAL 

...之後:

python setup.py build_ext --include-dirs=/usr/include/gdal/ 

,但我得到這個錯誤:

running build_ext 
building 'osgeo._gdal' extension 
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/gdal/ -I/usr/include/python2.7 -I/home/envs/test/local/lib/python2.7/site-packages/numpy/core/include -I/usr/include -c extensions/gdal_wrap.cpp -o build/temp.linux-x86_64-2.7/extensions/gdal_wrap.o 
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default] 
extensions/gdal_wrap.cpp: In function ‘int PyProgressProxy(double, const char*, void*)’: 
extensions/gdal_wrap.cpp:3237:2: warning: the address of ‘_Py_NoneStruct’ will never be NULL [-Waddress] 
extensions/gdal_wrap.cpp: In function ‘int GDALTransformerInfoShadow_TransformGeolocations(GDALTransformerInfoShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALProgressFunc, void*, char**)’: 
extensions/gdal_wrap.cpp:5010:69: error: ‘GDALTransformGeolocations’ was not declared in this scope 
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GOA2GetAuthorizationURL(PyObject*, PyObject*)’: 
extensions/gdal_wrap.cpp:5553:79: error: ‘GOA2GetAuthorizationURL’ was not declared in this scope 
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GOA2GetRefreshToken(PyObject*, PyObject*)’: 
extensions/gdal_wrap.cpp:5606:94: error: ‘GOA2GetRefreshToken’ was not declared in this scope 
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_GOA2GetAccessToken(PyObject*, PyObject*)’: 
extensions/gdal_wrap.cpp:5661:93: error: ‘GOA2GetAccessToken’ was not declared in this scope 
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_ReadDirRecursive(PyObject*, PyObject*)’: 
extensions/gdal_wrap.cpp:6081:61: error: ‘VSIReadDirRecursive’ was not declared in this scope 
extensions/gdal_wrap.cpp: In function ‘PyObject* _wrap_MajorObject_SetMetadata__SWIG_0(PyObject*, PyObject*)’: 
extensions/gdal_wrap.cpp:7501:31: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings] 
extensions/gdal_wrap.cpp: In function ‘int GDALTransformerInfoShadow_TransformGeolocations(GDALTransformerInfoShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALRasterBandShadow*, GDALProgressFunc, void*, char**)’: 
extensions/gdal_wrap.cpp:5011:3: warning: control reaches end of non-void function [-Wreturn-type] 
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1` 

有什麼建議嗎?我哪裏可能會出錯?

回答

7

看來Ubuntu 13.04上的libgdal1軟件包已經過期。 Python奶酪店(PyPi,這是pip使用的)提供了1.10.0包裝,而the 13.04 package list顯示提供了libgdal 1.9.0版。顯然,在1.10版本中,引入了一些新功能,這些功能是您所看到的「未聲明」錯誤。

因此,兩個選項:

  • 手動安裝libgdal 1.10。在這種情況下,您可以在配置腳本中使用--with-python選項,並且不需要安裝單獨的Python綁定。我想你也是最新最好的。

  • 下載一個較老的Python gdal包裝from the Python cheeseshop,並從那裏繼續。這可能是最簡單的選擇。

+0

我用了第二個選項!更簡單...它的工作..非常感謝。 –

+1

@ user566663你可以指出答案爲'回答'以幫助未來的訪問者,所以他們知道有一個工作解決方案(至少對你來說,但可能更多的人)。 – Evert

+0

非常感謝,你讓我在路上!版本錯配當然!對我來說,它是python gdal 1.11.x和gdal 1.10.x. –