【问题标题】:python setup.py build_ext --include-dirs=/usr/include/gdal/ not workpython setup.py build_ext --include-dirs=/usr/include/gdal/ 不起作用
【发布时间】:2013-09-27 07:54:39
【问题描述】:

我正在尝试在 virstualenvwrapper 中安装 GDAL,遵循几个指南和 StackOverflow 答案。

我在 ubuntu 13.04 我安装了 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`

有什么建议吗?我可能哪里出错了?

【问题讨论】:

    标签: python gdal virtualenvwrapper


    【解决方案1】:

    看来 Ubuntu 13.04 上的 libgdal1 软件包已经过时了。 Python cheeseshop(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,然后从那里继续。这可能是最简单的选择。

    【讨论】:

    • 我使用了第二个选项!更简单......它的工作原理......非常感谢。
    • @user566663 您可以将答案标为“已回答”以帮助未来的访问者,这样他们就知道有一个可行的解决方案(嗯,至少对您而言,但可能更多人)。
    • 非常感谢,您让我上路了!当然版本不匹配!对我来说,它是 python gdal 1.11.x 和 gdal 1.10.x。
    • 请注意,您可以告诉 PIP 安装您想要的版本作为第三个选项,如下所述:stackoverflow.com/questions/5226311/…
    • 如果您在 ubuntu 上偶然发现缺少标头问题,您可以通过以下方式解决:gis.stackexchange.com/questions/28966/…
    猜你喜欢
    • 2014-12-21
    • 2023-04-06
    • 2014-12-04
    • 2017-02-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-02-20
    相关资源
    最近更新 更多