1. 进入需要迁移的环境:
conda activate yolov8
2.打包迁移环境,注意安装打包库
- pip install conda-pack
-
- conda pack -n yolov8 -o yolov8_move.tar.gz
3. 转移打包的环境包,放到anaconda/envs 下面, 在envs 下面新建环境文件夹,解压环境包到;
- # Unpack environment into directory `chenran`
- mkdir -p chenran
- tar -xzf yolov8_move.tar.gz -C chenran
4. 激活环境测试:
- # activate chenran
- conda activate chenran
-
- pip list
-
- # 终端 python,测试
- import torch
- print(torch.__version__)
- print(torch.cuda.is_available())
Reference:
Conda 环境迁移 - 知乎 (zhihu.com)