Skip to content
README.md 3.94 KiB
Newer Older
# 环境配置指南> **前提假设**:ROOT 框架已安装并配置完成。本文档详细描述了从 GitLab 克隆项目后,如何配置运行环境。## 目录1.[克隆项目](#1-克隆项目)2.[安装依赖](#2-安装依赖)3.[运行 GUI](#3-运行-gui)4.[可选配置](#4-可选配置)5.[故障排除](#5-故障排除)6.[支持的平台](#6-支持的平台)---## 1. 克隆项目```bashgit clone cd```---## 2. 安装依赖### 2.1 检查 ROOT 环境(确认已配置)```bash# 验证 ROOT 是否正确配置root--version```如果未配置 ROOT,请先执行:```bashsource/path/to/root/bin/thisroot.sh```### 2.2 Python 环境```bash# 确保 Python 3.8+ 已安装python3--version```如果 Python 未安装,请先执行安装:```bashsudoapt-get update# Ubuntu/Debiansudoapt-getinstallpython3 python3-pip# Ubuntu/Debian#或brewinstallpython# macOS```安装 Tkinter(用于 GUI):```bashsudoapt-getinstallpython3-tk# Ubuntu/Debian# 或brewinstallpython-tk# macOS```### 2.3 CMake```bashsudoapt-getinstallcmake# Ubuntu/Debian# 或brewinstallcmake# macOS# 验证安装cmake--version```### 2.4 编译器```bashsudoapt-getinstallbuild-essential# Ubuntu/Debian# 或xcode-select--install# macOS# 验证安装gcc--versiong++--version```---## 3. 运行 GUI```bashpython3 program_gui.py```---## 4. 可选配置### 4.1 ROOT 环境变量持久化如果每次启动终端都需要手动配置 ROOT,可以将其添加到`~/.bashrc`:```bashecho"source /path/to/root/bin/thisroot.sh">>~/.bashrcsource~/.bashrc```### 4.2 配置文件运行 GUI 后点击 "save config" ,会自动生成`unfolding_config.json`配置文件,可根据需要修改默认参数;如果`unfolding_config.json`文件存在,运行 GUI 会自动加载其参数配置。如果`unfolding_config.json`文件不存在,运行 GUI 保持默认参数配置。---## 5. 故障排除### 问题1:GUI 无法启动 - Tkinter 错误```bash# 安装 Tkintersudoapt-getinstallpython3-tk# Ubuntu/Debianbrewinstallpython-tk# macOS```### 问题2:编译失败 - 缺少依赖```bashsudoapt-getinstalllibgsl-dev libfftw3-dev# Ubuntu/Debian```### 问题3:缺少共享库```bash# 更新库缓存ldconfig# 或者设置 LD_LIBRARY_PATHexportLD_LIBRARY_PATH=/path/to/root/lib:$LD_LIBRARY_PATH```### 问题4:ROOT 命令未找到```bash# 确保正确设置 ROOT 环境变量source/path/to/root/bin/thisroot.sh```---## 6. 支持的平台| 平台 | 状态 | 说明 ||------|------|------|| Linux (Ubuntu/Debian) | ✅ 支持 | 推荐使用 || macOS | ✅ 支持 | 使用 Homebrew 安装依赖 || Windows | ⚠️ 有限支持 | 建议使用 WSL |### macOS 配置说明```bash# 使用 Homebrew 安装依赖brewinstallpython-tkbrewinstallcmake```### Windows 配置说明建议使用**Windows Subsystem for Linux (WSL)**:1.启用 WSL 功能2.安装 Ubuntu 发行版3.按照 Linux 配置步骤进行---## 版本要求| 软件 | 最低版本 | 推荐版本 ||------|----------|----------|| ROOT | 6.20 | 6.28+ || Python | 3.8 | 3.10+ || CMake | 3.16 | 3.20+ || GCC | 7.0 | 11.0+ |---## 快速开始脚本可以创建一个`setup.sh`脚本快速配置:```bash#!/bin/bashecho"=== 克隆项目 ==="git clone cdecho"=== 配置环境 ==="source/path/to/root/bin/thisroot.shsudoapt-get updatesudoapt-getinstallpython3 python3-pipsudoapt-getinstallpython3-tksudoapt-getinstallcmakesudoapt-getinstallbuild-essentialecho"=== 启动 GUI ==="python3 program_gui.py```---## 联系信息如有问题,请联系项目维护者:-邮箱:-GitLab:
Baidu
map