问题出现前提:已安装homebrew和anaconda,在终端中
$brew update
$brew upgrade
$ conda update conda
$ conda install git
$ git clone https://github.com/gprMax/gprMax.git
(此处出现问题:
fatal:unable to access ‘https://github.com/gprMax/gprMax.git’ :OpenSSL_need:Operation timed out, errno 60
我把https://改为http://解决问题)
(base)$ cd gprMax
(gprMax)$ conda env create -f conda_env.yml
(gprMax)$ python setup.py build
(此处出现问题:
python: can’t open file ‘/Users/grey_nozomi/setup.py’: [Errno 2] No such file or directory
在finder目录中搜索到五十多条setup.py,用绝对路径代替不现实,要检查homebrew版本是否更新和
c
o
n
d
o
a
c
t
i
v
a
t
e
g
p
r
M
a
x
后是否缺一行
condo activate gprMax后是否缺一行
condoactivategprMax后是否缺一行cd gprMax。)
(gprMax)$ python setup.py install
(gprMax)$ python -m gprMax user_models/cylinder_Ascan_2D.in
(在http://docs.gprmax.com/en/latest/examples_simple_2D.html#introductory-2d-models上下载cylinder_Ascan_2D.in,在opt/anaconda3/envs/gprMax目录下创建user_models文件夹,将cylinder_Ascan_2D.in拖入)
在最后一句运行时,出现重大问题
ImportError: dlopen(/Users/grey_nozomi/opt/anaconda3/envs/gprMax/lib/python3.9/site-packages/gprMax-3.1.6-py3.9-macosx-10.9-x86_64.egg/gprMax/fields_updates_ext.cpython-39-darwin.so, 2): no suitable image found. Did find:
/Users/grey_nozomi/opt/anaconda3/envs/gprMax/lib/python3.9/site-packages/gprMax-3.1.6-py3.9-macosx-10.9-x86_64.egg/gprMax/fields_updates_ext.cpython-39-darwin.so: mach-o, but wrong architecture
/Users/grey_nozomi/opt/anaconda3/envs/gprMax/lib/python3.9/site-packages/gprMax-3.1.6-py3.9-macosx-10.9-x86_64.egg/gprMax/fields_updates_ext.cpython-39-darwin.so: mach-o, but wrong architecture
由于出现的是wrong architecture,我用lipo -info命令检查了python和.so文件架构。
(.in文件没有架构差异,用lipo -info会报错)
% lipo -info /Users/grey_nozomi/gprMax/gprMax/fields_updates_ext.cpython-39-darwin.so
Non-fat file: /Users/grey_nozomi/gprMax/gprMax/fields_updates_ext.cpython-39-darwin.so is architecture: arm64
% lipo -info /usr/bin/python
Architectures in the fat file: /usr/bin/python are: x86_64 arm64e
尝试搜寻关于arm64e的信息,只获知是用于m1和m2芯片的mac的arm架构,碰巧看到一篇详细介绍有关内容的科普贴:https://zhuanlan.zhihu.com/p/440986066
(此处:不要安装miniforge,不要安装miniforge,不要安装miniforge,conda足够用)
直接贴出解决方法:rm -rf!
$rm -rf anaconda3
$rm -rf ~/anaconda3
$rm -rf ~/opt/anaconda3
对,就是删库,教程https://docs.anaconda.com/anaconda/install/uninstall/
掀了桌子重新下载安装,官网自己找需要的版本下载Anaconda3-2022.05-MacOSX-arm64.sh
安装教程https://docs.anaconda.com/anaconda/install/mac-os/
把anaconda重装好,重新过一遍文章开头的命令(不用重新下载cylinder_Ascan_2D.in),在终端中顺利给出运行结果。



