无法使用pip在python 3中安装GDAL(铛失败,退出状态为1) [英] Unable to install GDAL in python 3 using pip (clang failed with exit status 1)
问题描述
从终端(Mac OS X Mavericks)运行 sudo pip3.4安装gdal
后,我收到一条错误消息,提示'col_port.h找不到'
文件并显示以下错误: command'/ user / bin / clang /失败,退出状态为1
(完整消息为下面)。
After running sudo pip3.4 install gdal
from terminal (Mac OS X Mavericks) I obtain an error message saying that the 'col_port.h'
file was not found and displaying the following error: command '/user/bin/clang/ failed with exit status 1
(the full message is below).
我有gdal 1.11(从kingchaos.com下载的完整框架版本)和最新版本的Xcode命令行工具-Apple LLVM版本5.1(clang-503.0) .40)(基于LLVM 3.4svn)
I have gdal 1.11 (the complete framework version downloaded from kingchaos.com) and the most recent version of the Xcode command line tools -Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
这是运行<$ c $后出现的错误c> sudo pip3.4 install gdal 命令:
/usr/bin/clang -fno-strict-aliasing -Werror=declaration-after-statement -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I../../port -I../../gcore -I../../alg -I../../ogr/ -I/Library/Frameworks/Python.framework/Versions/3.4/include/python3.4m -I/Library/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/numpy/core/include -I/Library/Frameworks/GDAL.framework/Versions/1.11/include -c extensions/gdal_wrap.cpp -o build/temp.macosx-10.6-intel-3.4/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:2535:22: warning: unused variable 'swig_empty_runtime_method_table' [-Wunused-variable]
static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
^
extensions/gdal_wrap.cpp:2855:10: fatal error: 'cpl_port.h' file not found
#include "cpl_port.h"
^
3 warnings and 1 error generated.
error: command '/usr/bin/clang' failed with exit status 1
推荐答案
解决方案是使用 homebrew
,然后运行 pip3.4
The solution was to use homebrew
and, after that, run pip3.4
brew install GDAL
,并且一旦安装,
pip3.4 install gdal
这篇关于无法使用pip在python 3中安装GDAL(铛失败,退出状态为1)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!