<div dir="ltr">Hi, <div><br></div><div>"brew install gdal" does work. I did it before, the problem is that I forget to add the PATH of gdal and the default PATH is to Anaconda.</div><div><br></div><div>Now, it works :D</div><div><br></div><div>Thank you.</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Andreas Oxenstierna <<a href="mailto:andreas.oxenstierna@t-kartor.com">andreas.oxenstierna@t-kartor.com</a>> 于2022年6月28日周二 15:28写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div>
<div name="messageBodySection">
<div dir="auto">Hi <br>
<br>
My gdal installation with brew, <a href="https://formulae.brew.sh/formula/gdal" target="_blank">https://formulae.brew.sh/formula/gdal</a>, do work on macOS:<br>
which gdal_calc.py<br>
/usr/local/bin/gdal_calc.py<br>
<br>
ls -l /usr/local/bin/gdal_calc*<br>
/usr/local/bin/gdal_calc.py -> ../Cellar/gdal/3.3.2_3/bin/gdal_calc.py<br>
<br>
Do you have to use Anaconda?</div>
</div>
<div name="messageSignatureSection"><br>
<div>Best Regards<br>
<br>
Andreas Oxenstierna<br>
T-Kartor Geospatial AB<br>
Olof Mohlins väg 12 Kristianstad<br>
mobile: +46 733 206831<br>
mailto: <a href="mailto:andreas.oxenstierna@t-kartor.com" target="_blank">andreas.oxenstierna@t-kartor.com</a><br>
<a href="http://www.t-kartor.com" target="_blank">www.t-kartor.com</a></div>
</div>
<div name="messageReplySection">On 28 Jun 2022, 05:19 +0200, Chao Li <<a href="mailto:chaoli0394@gmail.com" target="_blank">chaoli0394@gmail.com</a>>, wrote:<br>
<blockquote type="cite" style="border-left:thin solid grey;margin:5px;padding-left:10px">
<div dir="ltr">Hi,
<div><br>
</div>
<div>I meet a problem when I use gdal_calc.py on mac:</div>
<div><br>
</div>
<div>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">(base) lichao@riushios-MacBook-Pro ~ % gdal_calc.py
<span> </span></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">Traceback (most recent call last):</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/osgeo/__init__.py", line 29, in swig_import_helper</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> return importlib.import_module(mname)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> return _bootstrap._gcd_import(name[level:], package, level)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "<frozen importlib._bootstrap>", line 1030, in _gcd_import</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "<frozen importlib._bootstrap>", line 1007, in _find_and_load</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "<frozen importlib._bootstrap>", line 666, in _load_unlocked</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "<frozen importlib._bootstrap>", line 565, in module_from_spec</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "<frozen importlib._bootstrap_external>", line 1173, in create_module</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">ImportError: dlopen(/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/osgeo/_<a href="http://gdal.cpython-39-darwin.so" target="_blank">gdal.cpython-39-darwin.so</a>, 0x0002): Library not loaded:
@rpath/libpoppler.91.dylib</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> Referenced from: /Users/lichao/opt/anaconda3/lib/libgdal.30.dylib</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> Reason: tried: '/Users/lichao/opt/anaconda3/lib/libpoppler.91.dylib' (no such file), '/Users/lichao/opt/anaconda3/lib/libpoppler.91.dylib'
(no such file), '/Users/lichao/opt/anaconda3/lib/libpoppler.91.dylib' (no such file), '/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/osgeo/../../../libpoppler.91.dylib' (no such file), '/Users/lichao/opt/anaconda3/lib/libpoppler.91.dylib' (no such
file), '/Users/lichao/opt/anaconda3/lib/libpoppler.91.dylib' (no such file), '/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/osgeo/../../../libpoppler.91.dylib' (no such file), '/Users/lichao/opt/anaconda3/lib/libpoppler.91.dylib' (no such file),
'/Users/lichao/opt/anaconda3/bin/../lib/libpoppler.91.dylib' (no such file), '/Users/lichao/opt/anaconda3/lib/libpoppler.91.dylib' (no such file), '/Users/lichao/opt/anaconda3/bin/../lib/libpoppler.91.dylib' (no such file), '/usr/local/lib/libpoppler.91.dylib'
(no such file), '/usr/lib/libpoppler.91.dylib' (no such file)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px">
<span style="font-variant-ligatures:no-common-ligatures"></span><br>
</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">During handling of the above exception, another exception occurred:</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);min-height:13px">
<span style="font-variant-ligatures:no-common-ligatures"></span><br>
</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">Traceback (most recent call last):</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/bin/gdal_calc.py", line 4, in <module></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> __import__('pkg_resources').run_script('GDAL==3.4.1', 'gdal_calc.py')</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 662, in run_script</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> self.require(requires)[0].run_script(script_name, ns)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/pkg_resources/__init__.py", line 1459, in run_script</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> exec(code, namespace, namespace)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/GDAL-3.4.1-py3.9-macosx-10.9-x86_64.egg-info/scripts/gdal_calc.py", line
5, in <module></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> from osgeo_utils.gdal_calc import *<span> </span> # noqa</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/osgeo_utils/gdal_calc.py", line 46, in <module></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> from osgeo import gdal</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/osgeo/__init__.py", line 45, in <module></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> _gdal = swig_import_helper()</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/site-packages/osgeo/__init__.py", line 42, in swig_import_helper</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> return importlib.import_module('_gdal')</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> File "/Users/lichao/opt/anaconda3/lib/python3.9/importlib/__init__.py", line 127, in import_module</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><span> </span> return _bootstrap._gcd_import(name[level:], package, level)</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">ModuleNotFoundError: No module named '_gdal'</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<br>
</p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">(base) lichao@riushios-MacBook-Pro ~ % which gdal_calc.py</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">/Users/lichao/opt/anaconda3/bin/gdal_calc.py</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></p>
<p style="margin:0px;font:11px Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">(base) lichao@riushios-MacBook-Pro ~ % gdal-config --version</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"></span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">3.4.1</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">Thanks for your help.</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures"><br>
</span></p>
<p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)">
<span style="font-variant-ligatures:no-common-ligatures">Best</span></p>
<div><br>
</div>
--<br>
<div dir="ltr">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">------------------------------------------------------------------------------------</div>
<div dir="ltr">Mike Li
<div>Department of Urban and Environmental Engineering</div>
<div>Graduate School of Engineering</div>
<div>Kyushu University</div>
<div>744 Motooka, Nishi-ku, Fukuoka 819-0395 Japan</div>
<div>Tel: 090-8304-8953</div>
<div>E-mail: <a href="mailto:chaoli0394@gmail.com" target="_blank">chaoli0394@gmail.com</a></div>
<div>-------------------------------------------------------------------------------------</div>
<div>李潮(リ チョウ)</div>
<div>九州大学 大学院 工学府 都市環境システム工学専攻</div>
<div>都市工学研究室</div>
<div>-------------------------------------------------------------------------------------</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">------------------------------------------------------------------------------------</div><div dir="ltr">Mike Li<div>Department of Urban and Environmental Engineering</div><div>Graduate School of Engineering</div><div>Kyushu University</div><div>744 Motooka, Nishi-ku, Fukuoka 819-0395 Japan</div><div>Tel: 090-8304-8953</div><div>E-mail: <a href="mailto:chaoli0394@gmail.com" target="_blank">chaoli0394@gmail.com</a></div><div>-------------------------------------------------------------------------------------</div><div>李潮(リ チョウ)</div><div>九州大学 大学院 工学府 都市環境システム工学専攻</div><div>都市工学研究室</div><div>-------------------------------------------------------------------------------------</div></div></div></div></div></div></div>