Revertir, copiar y migrar el entorno conda

1 retroceso

En el entorno conda, puede utilizar el comando list para comprobar qué versiones del entorno conda actual están disponibles.

conda list -h

Puedes ver cómo usarlo: céntrate en los parámetros -n y -r.

usage: conda list [-h] [-n ENVIRONMENT | -p PATH] [--json] [-v] [-q] [--show-channel-urls] [-c] [-f] [--explicit] [--md5] [-e] [-r] [--no-pip] [regex]

List linked packages in a conda environment.

Options:

positional arguments:
  regex                 List only packages matching this regular expression.

optional arguments:
  -h, --help            Show this help message and exit.
  --show-channel-urls   Show channel urls. Overrides the value given by `conda config --show show_channel_urls`.
  -c, --canonical       Output canonical names of packages only. Implies --no-pip.
  -f, --full-name       Only search for full names, i.e., ^<regex>$.
  --explicit            List explicitly all installed conda packaged with URL (output may be used by conda create --file).
  --md5                 Add MD5 hashsum when using --explicit
  -e, --export          Output requirement string only (output may be used by conda create --file).
  -r, --revisions       List the revision history and exit.
  --no-pip              Do not include pip-only installed packages.

Target Environment Specification:
  -n ENVIRONMENT, --name ENVIRONMENT
                        Name of environment.
  -p PATH, --prefix PATH
                        Full path to environment location (i.e. prefix).

Output, Prompt, and Flow Control Options:
  --json                Report all output as json. Suitable for using conda programmatically.
  -v, --verbose         Use once for info, twice for debug, three times for trace.
  -q, --quiet           Do not display progress bar.

Examples:

List all packages in the current environment:

    conda list

List all packages installed into the environment 'myenv':

    conda list -n myenv

Save packages for future use:

    conda list --export > package-list.txt

Reinstall packages from an export file:

    conda create -n myenv --file package-list.txt

Entonces podemos usar el siguiente comando.

conda list -n yolov5-lh -r

 Puede ver que hay dos versiones del entorno conda actual.

Luego puede usar el siguiente comando para volver a la versión anterior

conda install --revision 0

2 Copiar y migrar

Hay varios métodos de copia. Aquí uso el comando cp directo para copiar el archivo completo en la ruta ens. Cada entorno conda que creemos tendrá una carpeta en la ruta /root/anaconda3/envs/.

 solo copialo

cp -drf /root/anaconda3/envs/yolov5_chw  /root/anaconda3/envs/yolov5_chw_new

Luego puedes activar el nuevo entorno con el siguiente comando.

conda activate yolov5_chw_new

De la misma forma, si queremos migrar el entorno conda de un determinado servidor a otro servidor, también podemos copiar directamente el paquete a otro servidor.

Supongo que te gusta

Origin blog.csdn.net/u013171226/article/details/131327042
Recomendado
Clasificación