Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vanleantking/1271b96321061741af2da500d4a15fb3 to your computer and use it in GitHub Desktop.
Save vanleantking/1271b96321061741af2da500d4a15fb3 to your computer and use it in GitHub Desktop.
virtualenv backup python environtment using
1.activate current env at your path
pyvenv-3.5 ~/Envs/thesis_python3/
source ~/Envs/thesis_python3/bin/activate
2. list all of modules using in the current environtment by using freeze
pip freeze > requirements.txt
(this command with generate txt file list all modules have installed)
3. create new env, and from this new env, install all modules have list in the txt file
pip install -r requirements.txt
Another solution, copy current env to another env:
cp -R ~/Envs/thesis_python3 ~/Envs/bk_thesis_python3
use your favorite editor to edit activate file of the new env
sudo vim bk_thesis_python3/bin/activate
Find the line VIRTUAL_ENV="~/Envs/thesis_python3" and replace it with
~/Envs/bk_thesis_python3 (your backup env)
--Enjoy....--
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment