【Anaconda】Virtual environment offline migration

【Anaconda】Virtual environment offline migration

In projects, we often encounter the problem of installing a virtual environment related to deep learning for anaconda in an offline environment. The server device cannot connect to the Internet.


Preface

In order to realize the purpose of transplanting the Anaconda virtual environment to other devices, it is necessary to export the virtual environment. This blog post details the offline migration of the virtual environment , export the complete virtual environment, and then copy it to the target host to complete the offline migration.
【Anaconda3】Common commands


environmental information

# 查看操作系统
systeminfo
# 查看所有虚拟环境
conda env list


Export virtual environment

Directly backing up the corresponding virtual environment package in the envs directory may have problems! ! ! Although bloggers often do this

# 得到的是一个.tar.gz压缩包
conda pack -n environment_name -o environment_name_pack.tar.gz
# eg:conda pack -n instant-neus -o instant-neus.tar.gz


The default address of the exported virtual environment package is in the path of cmd (when executing the command):

Restoring a virtual environment offline

Offline recovery only requires copying the virtual environment package to the temporary directory of the target environment, and then decompressing it to the envs directory of anaconda.

conda env list

The virtual environment has been added:


Summarize

The offline migration process of the virtual environment created by Anaconda is explained concisely and clearly.

Guess you like

Origin blog.csdn.net/yangyu0515/article/details/132079936