python – GDAL错误:命令’cc’失败,退出状态为1

python – GDAL错误:命令’cc’失败,退出状态为1,第1张

概述我对此问题越来越感到沮丧,但我一直在尝试重新安装GDAL以安装新版本的QGIS.当我尝试使用pip install GDAL安装它时,我得到以下内容: Installing collected packages: GDAL Running setup.py install for GDAL building 'osgeo._gdal' extension cc -fno-str 我对此问题越来越感到沮丧,但我一直在尝试重新安装GDAL以安装新版本的QGIS.当我尝试使用pip install GDAL安装它时,我得到以下内容:

Installing collected packages: GDAL  Running setup.py install for GDAL    building 'osgeo._gdal' extension    cc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/library/Frameworks/GDAL.framework/Versions/1.9/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-x86_64-2.7/extensions/gdal_wrap.o    extensions/gdal_wrap.cpp:2230:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]                        res = SWIG_AddCast(res);                        ~~~ ^              ~~~    extensions/gdal_wrap.cpp:2233:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]                        res = SWIG_AddCast(res);                        ~~~ ^              ~~~    extensions/gdal_wrap.cpp:3515:12: error: use of undeclared IDentifIEr 'GDALGetMetadataDomainList'        return GDALGetMetadataDomainList( self );               ^    extensions/gdal_wrap.cpp:3753:5: error: unkNown type name 'CPLVirtualMem'        CPLVirtualMem *vmem;        ^    extensions/gdal_wrap.cpp:3761:5: error: unkNown type name 'GDALTileOrganization'        GDALTileOrganization eTileOrganization;        ^    extensions/gdal_wrap.cpp:3836:15: warning: unused variable 'start_addr' [-Wunused-variable]            char* start_addr = (char*)CPLVirtualMemGetAddr( self->vmem ) + start_offset;                  ^    extensions/gdal_wrap.cpp:4237:9: error: unkNown type name 'CPLVirtualMem'            CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,^    extensions/gdal_wrap.cpp:4237:31: error: use of undeclared IDentifIEr 'GDALDatasetGetVirtualMem'            CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,^    extensions/gdal_wrap.cpp:4263:237: error: unkNown type name 'GDALTileOrganization'    SWIGINTERN CPLVirtualMemShadow *GDALDatasetShadow_GetTiledVirtualMem(GDALDatasetShadow *self,GDALRWFlag eRWFlag,int nXOff,int nYOff,int nXSize,int nYSize,int nTileXSize,int nTileYSize,GDALDataType eBufType,int band_List,int *pband_List,GDALTileOrganization eTileOrganization,size_t nCacheSize,char **options=NulL){                                                                                                                                                                                                                                                ^    extensions/gdal_wrap.cpp:4266:9: error: unkNown type name 'CPLVirtualMem'            CPLVirtualMem* vmem = GDALDatasetGetTiledVirtualMem( self,^    extensions/gdal_wrap.cpp:4620:9: error: unkNown type name 'CPLVirtualMem'            CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,^    extensions/gdal_wrap.cpp:4620:31: error: use of undeclared IDentifIEr 'GDALRasterBandGetVirtualMem'            CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,^    extensions/gdal_wrap.cpp:4647:9: error: unkNown type name 'CPLVirtualMem'            CPLVirtualMem* vmem = GDALGetVirtualMemauto( self,^    extensions/gdal_wrap.cpp:4647:31: error: use of undeclared IDentifIEr 'GDALGetVirtualMemauto'            CPLVirtualMem* vmem = GDALGetVirtualMemauto( self,^    extensions/gdal_wrap.cpp:4667:9: error: unkNown type name 'CPLVirtualMem'            CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,^    extensions/gdal_wrap.cpp:4667:31: error: use of undeclared IDentifIEr 'GDALRasterBandGetTiledVirtualMem'; dID you mean 'GDALRasterBandShadow_GetVirtualMem'?            CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                                  GDALRasterBandShadow_GetVirtualMem    extensions/gdal_wrap.cpp:4619:33: note: 'GDALRasterBandShadow_GetVirtualMem' declared here    SWIGINTERN CPLVirtualMemShadow *GDALRasterBandShadow_GetVirtualMem(GDALRasterBandShadow *self,int nBufXSize,int nBufYSize,size_t nPageSizeHint,char **options=NulL){                                    ^    extensions/gdal_wrap.cpp:4685:41: error: use of undeclared IDentifIEr 'GTO_BSQ'            vmemshadow->eTileOrganization = GTO_BSQ;                                            ^    extensions/gdal_wrap.cpp:4867:16: error: use of undeclared IDentifIEr 'GDALRATChangesAreWrittenTofile'            return GDALRATChangesAreWrittenTofile( self );                   ^    extensions/gdal_wrap.cpp:7845:31: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]            PyObject *item_List = PyMapPing_Items( obj1 );                                  ^    /usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1354:50: note: expanded from macro 'PyMapPing_Items'    #define PyMapPing_Items(O) PyObject_CallMethod(O,"items",NulL)                                                     ^    extensions/gdal_wrap.cpp:11385:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "B";                        ^    extensions/gdal_wrap.cpp:11390:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "h";                        ^    extensions/gdal_wrap.cpp:11395:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "H";                        ^    extensions/gdal_wrap.cpp:11400:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "i";                        ^    extensions/gdal_wrap.cpp:11405:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "I";                        ^    extensions/gdal_wrap.cpp:11410:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "f";                        ^    extensions/gdal_wrap.cpp:11415:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "F";                        ^    extensions/gdal_wrap.cpp:11420:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]          buf->format = "B";                        ^    extensions/gdal_wrap.cpp:13656:3: error: unkNown type name 'GDALTileOrganization'      GDALTileOrganization arg12 ;      ^    extensions/gdal_wrap.cpp:13768:24: error: unkNown type name 'GDALTileOrganization'      arg12 = static_cast< GDALTileOrganization >(val12);                           ^    extensions/gdal_wrap.cpp:23687:14: warning: explicitly assigning a variable of type 'voID *' to itself [-Wself-assign]      clIEntdata = clIEntdata;      ~~~~~~~~~~ ^ ~~~~~~~~~~    13 warnings and 17 errors generated.    error: command 'cc' Failed with exit status 1    Complete output from command /usr/local/opt/python/bin/python2.7 -c "import setuptools;__file__='/private/var/folders/y2/thsw8bnj0xz0vp55gcykptfw0000gn/T/pip_build_root/GDAL/setup.py';exec(compile(open(__file__).read().replace('\r\n','\n'),__file__,'exec'))" install --record /var/folders/y2/thsw8bnj0xz0vp55gcykptfw0000gn/T/pip-bLqvAE-record/install-record.txt --single-version-externally-managed:    running installrunning buildrunning build_pycreating buildcreating build/lib.macosx-10.7-x86_64-2.7copying gdal.py -> build/lib.macosx-10.7-x86_64-2.7copying ogr.py -> build/lib.macosx-10.7-x86_64-2.7copying osr.py -> build/lib.macosx-10.7-x86_64-2.7copying gdalconst.py -> build/lib.macosx-10.7-x86_64-2.7copying gdalnumeric.py -> build/lib.macosx-10.7-x86_64-2.7creating build/lib.macosx-10.7-x86_64-2.7/osgeocopying osgeo/__init__.py -> build/lib.macosx-10.7-x86_64-2.7/osgeocopying osgeo/gdal.py -> build/lib.macosx-10.7-x86_64-2.7/osgeocopying osgeo/gdal_array.py -> build/lib.macosx-10.7-x86_64-2.7/osgeocopying osgeo/gdalconst.py -> build/lib.macosx-10.7-x86_64-2.7/osgeocopying osgeo/gdalnumeric.py -> build/lib.macosx-10.7-x86_64-2.7/osgeocopying osgeo/ogr.py -> build/lib.macosx-10.7-x86_64-2.7/osgeocopying osgeo/osr.py -> build/lib.macosx-10.7-x86_64-2.7/osgeorunning build_extbuilding 'osgeo._gdal' extensioncreating build/temp.macosx-10.7-x86_64-2.7creating build/temp.macosx-10.7-x86_64-2.7/extensionscc -fno-strict-aliasing -fno-common -dynamic -I/usr/local/include -I/usr/local/opt/sqlite/include -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/usr/local/lib/python2.7/site-packages/numpy/core/include -I/library/Frameworks/GDAL.framework/Versions/1.9/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.7-x86_64-2.7/extensions/gdal_wrap.oextensions/gdal_wrap.cpp:2230:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]                    res = SWIG_AddCast(res);                    ~~~ ^              ~~~extensions/gdal_wrap.cpp:2233:11: warning: explicitly assigning a variable of type 'int' to itself [-Wself-assign]                    res = SWIG_AddCast(res);                    ~~~ ^              ~~~extensions/gdal_wrap.cpp:3515:12: error: use of undeclared IDentifIEr 'GDALGetMetadataDomainList'    return GDALGetMetadataDomainList( self );           ^extensions/gdal_wrap.cpp:3753:5: error: unkNown type name 'CPLVirtualMem'    CPLVirtualMem *vmem;    ^extensions/gdal_wrap.cpp:3761:5: error: unkNown type name 'GDALTileOrganization'    GDALTileOrganization eTileOrganization;    ^extensions/gdal_wrap.cpp:3836:15: warning: unused variable 'start_addr' [-Wunused-variable]        char* start_addr = (char*)CPLVirtualMemGetAddr( self->vmem ) + start_offset;              ^extensions/gdal_wrap.cpp:4237:9: error: unkNown type name 'CPLVirtualMem'        CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,^extensions/gdal_wrap.cpp:4237:31: error: use of undeclared IDentifIEr 'GDALDatasetGetVirtualMem'        CPLVirtualMem* vmem = GDALDatasetGetVirtualMem( self,^extensions/gdal_wrap.cpp:4263:237: error: unkNown type name 'GDALTileOrganization'SWIGINTERN CPLVirtualMemShadow *GDALDatasetShadow_GetTiledVirtualMem(GDALDatasetShadow *self,char **options=NulL){                                                                                                                                                                                                                                            ^extensions/gdal_wrap.cpp:4266:9: error: unkNown type name 'CPLVirtualMem'        CPLVirtualMem* vmem = GDALDatasetGetTiledVirtualMem( self,^extensions/gdal_wrap.cpp:4620:9: error: unkNown type name 'CPLVirtualMem'        CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,^extensions/gdal_wrap.cpp:4620:31: error: use of undeclared IDentifIEr 'GDALRasterBandGetVirtualMem'        CPLVirtualMem* vmem = GDALRasterBandGetVirtualMem( self,^extensions/gdal_wrap.cpp:4647:9: error: unkNown type name 'CPLVirtualMem'        CPLVirtualMem* vmem = GDALGetVirtualMemauto( self,^extensions/gdal_wrap.cpp:4647:31: error: use of undeclared IDentifIEr 'GDALGetVirtualMemauto'        CPLVirtualMem* vmem = GDALGetVirtualMemauto( self,^extensions/gdal_wrap.cpp:4667:9: error: unkNown type name 'CPLVirtualMem'        CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,^extensions/gdal_wrap.cpp:4667:31: error: use of undeclared IDentifIEr 'GDALRasterBandGetTiledVirtualMem'; dID you mean 'GDALRasterBandShadow_GetVirtualMem'?        CPLVirtualMem* vmem = GDALRasterBandGetTiledVirtualMem( self,^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~                              GDALRasterBandShadow_GetVirtualMemextensions/gdal_wrap.cpp:4619:33: note: 'GDALRasterBandShadow_GetVirtualMem' declared hereSWIGINTERN CPLVirtualMemShadow *GDALRasterBandShadow_GetVirtualMem(GDALRasterBandShadow *self,char **options=NulL){                                ^extensions/gdal_wrap.cpp:4685:41: error: use of undeclared IDentifIEr 'GTO_BSQ'        vmemshadow->eTileOrganization = GTO_BSQ;                                        ^extensions/gdal_wrap.cpp:4867:16: error: use of undeclared IDentifIEr 'GDALRATChangesAreWrittenTofile'        return GDALRATChangesAreWrittenTofile( self );               ^extensions/gdal_wrap.cpp:7845:31: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]        PyObject *item_List = PyMapPing_Items( obj1 );                              ^/usr/local/Cellar/python/2.7.5/Frameworks/Python.framework/Versions/2.7/include/python2.7/abstract.h:1354:50: note: expanded from macro 'PyMapPing_Items'#define PyMapPing_Items(O) PyObject_CallMethod(O,NulL)                                                 ^extensions/gdal_wrap.cpp:11385:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "B";                    ^extensions/gdal_wrap.cpp:11390:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "h";                    ^extensions/gdal_wrap.cpp:11395:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "H";                    ^extensions/gdal_wrap.cpp:11400:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "i";                    ^extensions/gdal_wrap.cpp:11405:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "I";                    ^extensions/gdal_wrap.cpp:11410:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "f";                    ^extensions/gdal_wrap.cpp:11415:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "F";                    ^extensions/gdal_wrap.cpp:11420:21: warning: conversion from string literal to 'char *' is deprecated [-Wdeprecated-writable-strings]      buf->format = "B";                    ^extensions/gdal_wrap.cpp:13656:3: error: unkNown type name 'GDALTileOrganization'  GDALTileOrganization arg12 ;  ^extensions/gdal_wrap.cpp:13768:24: error: unkNown type name 'GDALTileOrganization'  arg12 = static_cast< GDALTileOrganization >(val12);                       ^extensions/gdal_wrap.cpp:23687:14: warning: explicitly assigning a variable of type 'voID *' to itself [-Wself-assign]  clIEntdata = clIEntdata;  ~~~~~~~~~~ ^ ~~~~~~~~~~13 warnings and 17 errors generated.error: command 'cc' Failed with exit status 1

主要观点是最后一行:错误命令’cc’失败并退出状态.我已经尝试了几乎我在Stackoverflow和其他任何地方找到的修复,从导出CFLAG策略到删除文件.我仍然得到那个错误.

任何人都可以帮忙.

解决方法 我刚刚碰到这个(因此找到了你的问题).我通过确保我尝试安装的(Python)GDAL版本与系统上的libgdal版本相匹配来解决它.

在我的情况下,pip拉入GDAL == 1.11.0,而我的libgdal版本是1.10.1 dfsg-5ubuntu1.运行pip安装GDAL == 1.10.0(可能替换实际版本)应该做正确的事情.

您的编译器错误是GDAL 1.11.0,期望符号仅存在于最新版本的libgdal中.

总结

以上是内存溢出为你收集整理的python – GDAL错误:命令’cc’失败,退出状态为1全部内容,希望文章能够帮你解决python – GDAL错误:命令’cc’失败,退出状态为1所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1052858.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-25
下一篇 2022-05-25

发表评论

登录后才能评论

评论列表(0条)

保存