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
备份/恢复它们的推荐方法是什么?
我第一次尝试使用rdiff-backup在我恢复备份时拒绝了所有符号链接。
答案 0 :(得分:2)
rdiff-backup通常会按原样复制符号链接,但不会引用它们。您是否可以添加--include-symlinks选项?
" cp -p"或" rsync -a"也会保留符号链接。
答案 1 :(得分:2)
将环境冻结到一个文本文件中,然后再从中安装很容易!
template <typename Iter, typename OutIter, typename Pred, typename Transf>
OutIter transform_if(Iter begin, Iter end, OutIter out, Pred p, Transf t) {
while (begin != end) {
if (p(*begin)) {
*out = t(*begin);
++out;
}
++begin;
}
return out;
}
// ...
string encipher(string text) {
Alphabet a;
encipheredAlphabet = a.cipherLetters(keyword);
text.erase(
transform_if(text.begin(), text.end(), text.begin(),
[](char c) { return !is_punctuation(c); },
[](char c) { return tolower(c); }),
text.end());
return text;
}
然后在您想要安装时
pip freeze > requirements.txt