Python 版本管理
使用 Conda 管理不同版本的 Python 环境。
查看版本
bash
python --version
which python创建指定版本环境
bash
conda create -n py38 python=3.8 -y
conda create -n py310 python=3.10 -y
conda create -n py311 python=3.11 -y切换环境
bash
conda activate py310
conda deactivate
conda env list版本推荐
| 版本 | 状态 | 建议 |
|---|---|---|
| 3.8 | 维护中 | 旧项目兼容 |
| 3.9 | 维护中 | 稳定 |
| 3.10 | 活跃 | 推荐 |
| 3.11 | 活跃 | 性能优化 |
框架兼容性
PyTorch
| 版本 | Python |
|---|---|
| 2.1+ | 3.8 - 3.11 |
| 2.0 | 3.8 - 3.11 |
| 1.13 | 3.7 - 3.10 |
TensorFlow
| 版本 | Python |
|---|---|
| 2.15+ | 3.9 - 3.11 |
| 2.14 | 3.9 - 3.11 |
安装到数据盘
bash
conda config --add envs_dirs /root/rivermind-data/conda/envs常见问题
命令找不到:执行 conda init bash && source ~/.bashrc
版本冲突:为不同项目创建独立环境
pip 安装到错误环境:使用 python -m pip install
