Python virtual environment migration

environment

  • windows 10 64bit

  • anaconda 2022

  • conda-pack 0.6.0

Introduction

When running some large-scale deep learning projects, the environment configuration often takes a large part of the time. If you encounter some version problems of dependent libraries, it may take longer. Wouldn't it be a bit of a crash if you had to install it again on another machine? What if there are 10 machines? What if there is no network environment yet? This article introduces a method that can quickly realize the migration of the environment, it is conda-pack.

Practical

It is assumed here that there are 2 machines, the source machine and the target machine both use anacondathe environment , and there is already a wav2lipvirtual environment called in the source machine, and the dependent libraries needed to run wav2lipthis . Now it is necessary to migrate wav2lipthe environment to the target machine, so that the target machine can directly use this virtual environment and let the project run.

First, install the migration tool on the source machine

pip install conda-pack

Then you can export, execute the command

conda pack -n wav2lip

Among them, -nthe parameter is followed by the name of the virtual environment. After exporting, it is a tar.gzfile , which is a compressed package

a0348419b4cdd43543a18c73c1229575.png

After completion, copy tar.gzthe file to the target machine. If windowsit is the system, install it git for window, so that you can use the command linuxunder to decompress it. The address is: https://gitforwindows.org/

After installation, right click to open git bash, create a folder, then enter the folder, unzip

55ee89061d06bdc51fcf41b4f1104bfd.png

mkdir wav2lip 
cd wav2lip
tar xvf wav2lip.tar.gz

After completion, wav2lipcopy anacondato the directory of the virtual environment, here isD:\Tools\anaconda3\envs

Finally, open cmdto verify

c7dd3bf4bb53304acfcf2eeb2d3f3d7e.png

51b8027eea8caed310186aa56e873687.png

Guess you like

Origin blog.csdn.net/djstavaV/article/details/129701010