This blog is about the useful command of importing environment.
You are welcomed to chat about it and if you like this blog, do not forget to give me a like.
Welcome to see my homepage and contact me: NicholasYe’s Homepage.
1. If you want to export the environment or import the environment
- simple step
- use
pip freeze > requirements.txtorpip list --format=freeze > requirements.txtto generate requirement list - use
pip install -r requirements.txtorconda install --yes --file requirements.txtto install the list
2. If you encounter some problems, try these commands
- higher level step
- if
requirements.txthas some invalid packageswhile read requirement; do conda install --yes $requirement; done < requirements.txt
- if can not use
condabut can usepipwhile read requirement; do conda install --yes $requirement || pip install $requirement; done < requirements.txt
- if
3. Another way of importing or exporting environment
- export:
conda env export > freeze.yml
- import:
conda env create -f freeze.yml
Please clearly mark the source of the article in the process of reproducing it! Respect for originality and intellectual property rights, thanks!
本文介绍了如何使用pip和conda命令来导出和导入Python环境,包括生成依赖项列表及安装这些依赖项的方法,并提供了解决常见问题的命令。此外,还提供了一种使用conda env export和conda env create命令进行环境管理的替代方案。
4万+

被折叠的 条评论
为什么被折叠?



