0

我想开始使用geodjango,为此我必须安装gdal。我正在使用 MacOS 10.8.3 为了按照 geodjango 文档中的建议使用 brew 执行此操作,但我收到以下错误:

$brew install gdal 
==> Downloading http://download.osgeo.org/gdal/1.10.0/gdal-1.10.0.tar.gz
Already downloaded: /Library/Caches/Homebrew/gdal-1.10.0.tar.gz
==> ./configure --prefix=/usr/local/Cellar/gdal/1.10.0 --mandir=/usr/local/Cellar/gdal/1.10.0/share/man --with-local=/usr/local/Cellar/gdal/1.10.0 --with-threads --with-libtool -
==> make
==> make install
==> /Users/Lucas/.virtualenvs/geotest/bin/python setup.py install --prefix=/usr/local/Cellar/gdal/1.10.0 --record=installed.txt --single-version-externally-managed
gcc-4.2 -bundle -undefined dynamic_lookup -g -L/usr/local/opt/sqlite/lib -lsqlite3 -I/usr/local/opt/sqlite/include -arch x86_64 build/temp.macosx-10.6-intel-2.7/extensions/gdalconst_wrap.o -L../../.libs -L../../ -L/private/tmp/gdal-gOux/gdal-1.10.0/lib -lgdal -o build/lib.macosx-10.6-intel-2.7/osgeo/_gdalconst.so
Your Xcode and or CLT are mis-configured. Try some or all of the following:
    xcodebuild -license
    sudo xcode-select -switch /path/to/Xcode.app
error: command 'gcc-4.2' failed with exit status 1
READ THIS: https://github.com/mxcl/homebrew/wiki/troubleshooting

These open issues may also help:
    https://github.com/mxcl/homebrew/issues/19845
    https://github.com/mxcl/homebrew/issues/20373
    https://github.com/mxcl/homebrew/pull/20457

按照建议,我做了:

xcodebuild -license

并同意许可,然后:

sudo xcode-select -switch /Applications/Xcode.app

我也检查了这些问题,但没有一个有帮助。

我已经安装了 Xcode 4.6.3 并且在过去酿造了许多其他公式,没有任何问题。

当我运行 brew doctor 时,我得到:

$brew doctor
Warning: "config" scripts exist outside your system or Homebrew directories.
`./configure` scripts often look for *-config scripts to determine if
software packages are installed, and what additional flags to use when
compiling and linking.

Having additional scripts in your path can confuse software installed via
Homebrew if the config script overrides a system or Homebrew provided
script of the same name. We found the following "config" scripts:

    /Library/Frameworks/Python.framework/Versions/2.7/bin/python-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python2-config
    /Library/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
    /Applications/Postgres.app/Contents/MacOS/bin/gdal-config
    /Applications/Postgres.app/Contents/MacOS/bin/geos-config
    /Applications/Postgres.app/Contents/MacOS/bin/uuid-config
    /Applications/Postgres.app/Contents/MacOS/bin/xml2-config

我不想从我的路径中删除 postgres.app,因为它是 postgres.app 配置的 CLI 所必需的,如下所述:http: //postgresapp.com/documentation#toc_1

关于库中的python,我尝试使用以下方法删除它们:

PATH=$(echo $PATH |sed 's/\/Library\/Frameworks\/Python.framework\/Versions\/2.7\/bin//')

如此处建议:https ://www.linuxquestions.org/questions/linux-newbie-8/how-to-remove-directory-from-%24path-483463/ 。但它并没有从路径中删除任何东西。

所以在这里我没有安装 gdal ...

4

1 回答 1

0

我在 SO 上找到了一种解决方法,我找不到原始帖子,但在这个帖子上给出了类似的信息:在 Mac OS X Lion 10.7.5 上安装 Scipy

所以我在我的 .bashrc 中添加了以下几行,然后我设法 brew install gdal。

export CC=gcc
export CXX=g++

请注意,这并没有完全解决我的问题,因为我仍然有 geodjango 的配置问题,但至少我安装了 gdal。

于 2013-07-16T17:13:33.177 回答