有时候我们好不容易配齐了一个环境,想从A服务器迁移到B服务器上。尤其是哪些偏门的环境。 比如能够处理windows 程序的linux环境之类的。
安装打包工具
conda install -c conda-forge conda-pack
打包本地conda环境
# Pack environment my_env into my_env.tar.gz
$ conda pack -n my_env
# Pack environment my_env into out_name.tar.gz
$ conda pack -n my_env -o out_name.tar.gz
# Pack environment located at an explicit path into my_env.tar.gz
$ conda pack -p /explicit/path/to/my_env
复制环境到其他电脑上:文章来源:https://www.toymoban.com/news/detail-561422.html
# Unpack environment into directory `my_env`
$ mkdir -p my_env
$ tar -xzf my_env.tar.gz -C my_env
# Use Python without activating or fixing the prefixes. Most Python
# libraries will work fine, but things that require prefix cleanups
# will fail.
$ ./my_env/bin/python
# Activate the environment. This adds `my_env/bin` to your path
$ source my_env/bin/activate
# Run Python from in the environment
(my_env) $ python
# Cleanup prefixes from in the active environment.
# Note that this command can also be run without activating the environment
# as long as some version of Python is already installed on the machine.
(my_env) $ conda-unpack
我通过这个方法,把一个环境成功迁移到了docker上,花了一天时间,在此记录一下。文章来源地址https://www.toymoban.com/news/detail-561422.html
到了这里,关于【Conda迁移环境】的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!