如何 backup/restor python virtualenv?
How to backup/restor python virtualenv?
A python virtualenv 充满了符号链接:
$ virtualenv venv
Running virtualenv with interpreter /usr/bin/python2
New python executable in venv/bin/python2
Also creating executable in venv/bin/python
Installing setuptools, pip...done.
$ tree venv/lib/
venv/lib/
├── python2.7
│ ├── _abcoll.py -> /usr/lib/python2.7/_abcoll.py
│ ├── _abcoll.pyc
│ ├── abc.py -> /usr/lib/python2.7/abc.py
│ ├── abc.pyc
│ ├── codecs.py -> /usr/lib/python2.7/codecs.py
│ ├── codecs.pyc
│ ├── copy_reg.py -> /usr/lib/python2.7/copy_reg.py
│ ├── copy_reg.pyc
│ ├── distutils
│ │ ├── distutils.cfg
│ │ ├── __init__.py
│ │ └── __init__.pyc
│ ├── encodings -> /usr/lib/python2.7/encodings
│ ├── fnmatch.py -> /usr/lib/python2.7/fnmatch.py
│ ├── fnmatch.pyc
│ ├── genericpath.py -> /usr/lib/python2.7/genericpath.py
│ ├── genericpath.pyc
backup/restor他们的推荐方法是什么?
我使用 rdiff-backup 的第一次尝试在我恢复备份时取消了对所有符号链接的引用。
rdiff-backup 通常按原样复制符号链接而不引用它们。您是否添加了 --include-symlinks 选项?
"cp -p" 或 "rsync -a" 也会保留符号链接。
将环境冻结到一个文本文件中并稍后从中安装很容易!
pip freeze > requirements.txt
然后当你想安装时
pip install -r requirements.txt
A python virtualenv 充满了符号链接:
$ virtualenv venv
Running virtualenv with interpreter /usr/bin/python2
New python executable in venv/bin/python2
Also creating executable in venv/bin/python
Installing setuptools, pip...done.
$ tree venv/lib/
venv/lib/
├── python2.7
│ ├── _abcoll.py -> /usr/lib/python2.7/_abcoll.py
│ ├── _abcoll.pyc
│ ├── abc.py -> /usr/lib/python2.7/abc.py
│ ├── abc.pyc
│ ├── codecs.py -> /usr/lib/python2.7/codecs.py
│ ├── codecs.pyc
│ ├── copy_reg.py -> /usr/lib/python2.7/copy_reg.py
│ ├── copy_reg.pyc
│ ├── distutils
│ │ ├── distutils.cfg
│ │ ├── __init__.py
│ │ └── __init__.pyc
│ ├── encodings -> /usr/lib/python2.7/encodings
│ ├── fnmatch.py -> /usr/lib/python2.7/fnmatch.py
│ ├── fnmatch.pyc
│ ├── genericpath.py -> /usr/lib/python2.7/genericpath.py
│ ├── genericpath.pyc
backup/restor他们的推荐方法是什么?
我使用 rdiff-backup 的第一次尝试在我恢复备份时取消了对所有符号链接的引用。
rdiff-backup 通常按原样复制符号链接而不引用它们。您是否添加了 --include-symlinks 选项?
"cp -p" 或 "rsync -a" 也会保留符号链接。
将环境冻结到一个文本文件中并稍后从中安装很容易!
pip freeze > requirements.txt
然后当你想安装时
pip install -r requirements.txt