Build a deep learning environment offline
Article Directory
Sometimes due to confidentiality and security requirements, we need to configure a deep learning environment on computers that cannot connect to the external network to carry out related work.
This article shares the relevant experience of configuring a deep learning environment on a computer that cannot be connected to the Internet
Hardware support: computers 转接计算机
that can be connected to the external network ( ), computers that cannot be connected to the external network ( 目标计算机
)
Anaconda3 offline installation
Download the installation package with the help of a networkable PC
In 转接计算机
the download installation packages
official website to download
Tsinghua image
after the download ssh
transfer to目标计算机
Install Anaconda3
Install Anaconda3 on 转接计算机
and 目标计算机
respectively
Open the directory where the Anaconda installation package is located and install the
installation command as
bash Anaconda-...-Linux-*,sh
Automatically configure conda environment selection yes
to activate the environment after installation
source ~/.bashrc
Configure the deep learning environment
Method: 转接计算机
Configure the deep learning environment on the Internet, package and transfer to目标计算机
Get a deep learning environment
In the 转接计算机
creation sandbox environments conda command, envirement
for the sandbox name
conda create -n envirement python=3.8
Use pip, conda and other methods to install the required package, you can switch the domestic source to improve the download speed
Packaging a deep learning environment
After 转接计算机上
entering the */anaconda3/envs/
directory, package the environment to be copied
tar cvf envirement.tar envirement
It must be packaged when the environment is migrated, otherwise the link information in the environment will be destroyed! ! !
Copy the deep learning environment
Copy the envirement.tar
file from the directory 转接计算机
to which it 目标计算机
is copied via http, ssh, etc. */anaconda3/envs/
, and unpack
This part 目标计算机
is carried out on* : path of envirement.tar
rsync -rzP */envirement.tar ~/anaconda3/envs/
cd ~/anaconda3/envs
tar xvf envirement.tar
Add a deep learning environment to the environment list
Finally, 目标计算机
modify the conda environment configuration file ~/.conda/envirement.txt
and add the copied environment directory at the end
vim ~/.conda/envirement.txt
/root/anaconda3
/root/anaconda3/envs/envirement
This 离线搭建深度学习环境
task is completed,
- Use to
conda env list
check whether the environment is created successfully - After using the
conda activate envirement
activation environment, you can test whether the specific package is installed successfully through the specific program
Note: No need to executeconda create -n [name] --clone [path] --offline