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