gprMAX安装教程-MacOS
Published:
前置工作:
- 配置python环境;
- 下载miniconda;
- 下载gcc;
brew install gcc
# 替换 brew.git
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# 替换 homebrew-core.git
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set'url' origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# 替换 bottles(预编译二进制包)
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.zshrc
source ~/.zshrc
# 清除 GCC 相关缓存
brew cleanup
brew uninstall gcc
rm -rf $(brew --cache)/gcc*
#确保Homebrew是新的版本
brew update
brew upgrade
#下载gcc
brew install gcc
- 下载gprMAX;
conda update conda
conda install git
git clone https://github.com/gprMax/gprMax.git
具体安装步骤
- 创建并激活独立虚拟环境(不要放在项目目录内)
MacOS:(Win)
# 先搞一个虚拟环境并启用
cd ~/Documents
python3 -m venv gprmax-env
source gprmax-env/bin/activate
- 升级工具链并安装构建依赖(必须提前装!)
#确保你的 macOS 和 Xcode 工具是新版本(尤其是如果你用的是 Apple Silicon 芯片的 Mac)。
# 安装/更新命令行工具
xcode-select --install
# 检查是否指向正确路径
xcode-select -p
# 应输出类似:/Library/Developer/CommandLineTools
python -m pip install --upgrade pip setuptools wheel
python -m pip install numpy Cython
- 进入 gprMax 源码目录,使用 –no-build-isolation 安装
cd gprMAX-1/gprMax-master
python -m pip install -e . --no-build-isolation
- 验证是否下载成功:
python -c "import gprMax; print('✅ gprMax version:', gprMax.__version__)"
