Python GDAL未安装在Mac OSX El Capitan上 [英] Python GDAL does not install on Mac OSX El Capitan

查看:167
本文介绍了Python GDAL未安装在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:

  1. http://www.kyngchaos.com/software/frameworks#gdal_complete
  2. pip install gdal
  1. Install GDAL Libraries from http://www.kyngchaos.com/software/frameworks#gdal_complete
  2. 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 !!!

这是我所做的:

  1. 在您的系统中找到cp_port.h文件:sudo find / -name cpl_port.h,我的输出是:
  1. 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

  1. 将生成的文件夹添加到bash初始化脚本(〜/.bash_login或〜/.zshrc)中的$ PATH中.这对我有用:export PATH=/Library/Frameworks/GDAL.framework/Headers:$PATH
  2. 打开一个新的终端会话或source ~/.zshrc
  1. 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
  2. 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆