LoginSignup
5
3

More than 1 year has passed since last update.

GDALをMacにインストールする

Posted at

GDALをMacにインストールする方法はこんな記事があり以前お世話になりました。今回はQGIS等は使わずにパッケージマネージャーのHomebrewとpipを使ってインストールします。

環境

各種ツール等のバージョンは以下の通り。

OS: Mac OSX Catalina
GDAL: 3.3.0
Python: 3.3.6
Homebrew: 3.1.12
pip: 21.1.2

インストール方法

ターミナルで以下のコマンドを実行します。

たくさんログを吐きますが、気にせず進めます。

brew install gdal
pip download GDAL
tar -xpzf GDAL-3.3.0.tar.gz
cd GDAL-3.3.0
python setup.py build_ext --gdal-config /usr/local/Cellar/gdal/<GDALのバージョン>/bin/gdal-config
python setup.py build
python setup.py install



ダウンロードしたGDALのバージョンがわからない場合は ls /usr/local/Cellar/gdal/ で確認しましょう。

確認方法

それぞれバージョン情報が表示されればOKです。

GDAL

gdalinfo --version
gdal_merge.py --version

Python

Pythonの環境で以下のコマンドを実行します。

>>> from osgeo import gdal
>>> gdal.VersionInfo()

スペシャルサンクス

こちらを参考にしました。Thank you Kelvin!
kelvinn/InstallPythonGDAL

5
3
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
3