高效地将 conda 环境转移到另一台 PC
这可能是一个菜鸟问题,我是使用 Conda 环境的新手。我正在寻找一些关于如何以最佳方式处理以下工作流程的建议。
我有一台工作台式机和一台家用台式机。我希望最终能够将我的工作环境带回家。
注意:我在 Ubuntu 上的 Windows 子系统上工作
假设我从头开始一个项目。我当前使用以下工作流程:
我创建一个 conda 环境。
conda create --name my_new_project python=3.10
激活我的工作区。
conda 激活 my_new_project
我安装我需要的 python 包:
conda install -c conda-forge opencv 等等...
在一天结束时,我想复制该环境并将其带到另一台电脑,所以我执行以下操作:
conda env 导出 --f my_new_project.yml
最后在我的家用 PC 上执行
conda env create --file my_new_project.yml
这可以工作,但需要我每次切换电脑时创建一个新环境。有没有办法加载两个 conda 环境之间的差异并仅添加新包?或者还有其他更好的方法来解决这个问题吗?
This may be a noob question, I am new to using Conda environments. I am looking for some advice on how to tackle the following workflow in the best way.
I have both a work desktop and a desktop at home. I want to be able to, at the end of the day, take my work environment home.
Note: I work in Ubuntu on subsystems for windows
Say I start a project from scratch. I currently use the following workflow:
I create a conda environment.
conda create --name my_new_project python=3.10
activate my workspace.
conda activate my_new_project
I install python packages I need:
conda install -c conda-forge opencv
etc...At the end of the day I want to copy that environment and take it to another PC, so I do the following:
conda env export --f my_new_project.yml
Finally on my home PC I do
conda env create --file my_new_project.yml
This works but requires me to make a new environment every time I switch PC. Is there a way to load the differences between the two conda environments and only add the new packages? Or is there another better way to tackle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
无需每次都创建新环境。您只需执行一次,然后更新现有环境,即使用以下内容作为步骤 5:
如果您还没有这样做,我还建议您将代码(包括依赖项文件)放入版本控制中。然后,在另一台计算机上加快项目速度只需要两个步骤。
There's no need to create a new environment every time. You only do that once and then update the existing environment, i.e. use the following as step 5:
I also suggest you to put your code, including the dependencies file, into version control if you aren't doing that already. Then, getting up to speed with your project on a different computer will only require two steps.