JY的興趣行李箱

一個數據分析師的個人興趣分享,走到哪寫到哪 可能是程式技能分享、綜藝點評、舞台/歌曲/樂曲/電影收藏、書摘、產業觀察等

【Python】複製一份 conda 環境的各種方式

使用 .yml 檔案
  • 將當前環境設置輸出為 environment.yml ,再用來創建配置一致的新環境
(base) ~$ conda activate current_env
(<meta charset="utf-8">current_env) ~$ conda env export > environment.yml
<meta charset="utf-8">(<meta charset="utf-8">current_env) ~$ conda deactivate
(base) ~$ conda env create -n new_env -f environment.yml
  • 更新現有環境
<meta charset="utf-8">(<meta charset="utf-8">current_env) ~$ conda env update -f <meta charset="utf-8">environment.yml --prune
使用 .txt 檔案
<meta charset="utf-8">(base) ~$ conda activate current_env
<meta charset="utf-8">(<meta charset="utf-8">current_env) ~$ conda list --explicit > spec_file.txt
<meta charset="utf-8">(<meta charset="utf-8">current_env) ~$ conda deactivate
(base) ~$ conda create -n new_env -f spec_file.txt

更多 conda 指令:

https://docs.conda.io/projects/conda/en/latest/_downloads/843d9e0198f2a193a3484886fa28163c/conda-cheatsheet.pdf

Like my work??
Don't forget to support or like, so I know you are with me..

CC BY-NC-ND 2.0

Want to read more ?

Login with one click and join the most diverse creator community.