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.txt
orpip list --format=freeze > requirements.txt
to generate requirement list - use
pip install -r requirements.txt
orconda install --yes --file requirements.txt
to install the list
2. If you encounter some problems, try these commands
- higher level step
- if
requirements.txt
has some invalid packageswhile read requirement; do conda install --yes $requirement; done < requirements.txt
- if can not use
conda
but can usepip
while 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!