Python GDAL未安装在Mac OSX El Capitan上 [英] Python GDAL does not install on Mac OSX El Capitan
问题描述
在Mac OSX El capitan中安装pygdal时遇到几个问题.步骤如下:
I am having several issues when installing pygdal in my Mac OSX El capitan. The procedure is the folowing:
- 从 http://www.kyngchaos.com/software/frameworks#gdal_complete
-
pip install gdal
- Install GDAL Libraries from http://www.kyngchaos.com/software/frameworks#gdal_complete
pip install gdal
输出如下:
.
.
.
extensions/gdal_wrap.cpp:3085:10: fatal error: 'cpl_port.h' file not found
#include "cpl_port.h"
^
2 warnings and 1 error generated.
error: command 'cc' failed with exit status 1
看起来安装程序找不到GDAL库或标头(ubuntu中的libgdal或gdal-devel).
Looks like the installer cannot find the GDAL libraries, or headers (libgdal or gdal-devel in ubuntu).
它们放在OSX中的什么位置?
Where are they placed in OSX?
仅供参考,以下/Library/Frameworks/GDAL.framework/Programs
放入$PATH
变量中.
FYI, the following /Library/Frameworks/GDAL.framework/Programs
is into the $PATH
variable.
推荐答案
我终于(在 Cam_Aust 的帮助下,一个>)解决了问题!
I finally (with a little help from Cam_Aust) solved the problem !!!
这是我所做的:
- 在您的系统中找到cp_port.h文件:
sudo find / -name cpl_port.h
,我的输出是:
- Find the cp_port.h file in your system:
sudo find / -name cpl_port.h
, My output was:
/Library/Frameworks/GDAL.framework/Versions/1.11/Headers/cpl_port.h /opt/local/include/cpl_port.h
- 将生成的文件夹添加到bash初始化脚本(〜/.bash_login或〜/.zshrc)中的$ PATH中.这对我有用:
export PATH=/Library/Frameworks/GDAL.framework/Headers:$PATH
- 打开一个新的终端会话或
source ~/.zshrc
- Add the resulting folders to your $PATH in your bash init script (~/.bash_login or ~/.zshrc). This worked for me:
export PATH=/Library/Frameworks/GDAL.framework/Headers:$PATH
- Open a new terminal session or
source ~/.zshrc
此后,您现在可以pip install gdal
:
Collecting gdal
Using cached GDAL-2.1.0.tar.gz
Installing collected packages: gdal
Running setup.py install for gdal ... done
Successfully installed gdal-2.1.0
这篇关于Python GDAL未安装在Mac OSX El Capitan上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!