conda-pack迁移虚拟环境
conda-pack打包迁移环境
源机器上:
# 创建并激活环境
conda create --name myenv python=3.8
conda activate myenv
# 安装所需包
conda install numpy pandas
# 打包环境
conda install -c conda-forge conda-pack
conda pack -n myenv -o myenv.tar.gz
目标机器上:
#安装conda-pack包
conda install -c conda-forge conda-pack
# 传输压缩包到目标机器
scp myenv.tar.gz username@cloud_server_ip:/path/to/destination
# 解压压缩包
cd /path/to/destination
tar -xzf myenv.tar.gz
# 修复环境路径
cd /path/to/destination/myenv
conda-unpack
# 激活环境
conda activate /path/to/destination/myenv
#手动注册环境
conda config --add envs_dirs /path/to/destination/myenv