36 lines
762 B
Markdown
36 lines
762 B
Markdown
# Mesa仿真
|
||
|
||
## 配置环境
|
||
|
||
**requirements.txt**
|
||
|
||
```text
|
||
mesa[rec] # 包含 networkx、matplotlib、ipywidgets、solara 等推荐依赖
|
||
jupyterlab
|
||
numpy
|
||
pandas
|
||
```
|
||
|
||
**Conda 命令行**
|
||
|
||
```bash
|
||
# 1) 添加 conda-forge 通道并设为最高优先级
|
||
conda config --add channels conda-forge
|
||
conda config --set channel_priority strict
|
||
|
||
# 2) 创建并激活新环境(这里以 python 3.11 为例)
|
||
conda create -n mesa-env python=3.11 -y
|
||
conda activate mesa-env
|
||
|
||
# 3a) 通过 pip 安装(使用上面的 requirements.txt)
|
||
pip install -r requirements.txt
|
||
|
||
# 或者 3b) 纯 Conda 安装等价包(推荐所有包都从 conda-forge)
|
||
conda install \
|
||
mesa=3.1.5 networkx matplotlib ipywidgets solara \
|
||
numpy pandas jupyterlab \
|
||
-c conda-forge
|
||
|
||
```
|
||
|