的Ubuntu 12.10日志模块中的virtualenv
虽然试图获得瓶+日志记录在virtualenv中工作,我发现它似乎日志模块没有得到来自的virtualenv(以下片段最后一行)进口。
(我认为这是具有不打印到时候我的烧瓶应用程序是一个的virtualenv中运行日志文件的副作用,但我会要求单独,如果这个问题没有帮助)
为什么这是??记录模块是否特别?
# system python
# imports come from /usr/lib/python2.7 as expected
[email protected]:~/Desktop$ python
Python 2.7.3 (default, Apr 10 2013, 05:13:16)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re; print re
<module 're' from '/usr/lib/python2.7/re.pyc'> # OK
>>> import logging; print logging
<module 'logging' from '/usr/lib/python2.7/logging/__init__.pyc'> # OK
>>> exit()
# make virtual env
[email protected]:~/Desktop$ virtualenv --version
14.0.0
[email protected]:~/Desktop$ virtualenv testenv
New python executable in /home/me/Desktop/testenv/bin/python
Installing setuptools, pip, wheel...done.
# Try again inside venv
[email protected]:~/Desktop$ source testenv/bin/activate
(testenv) [email protected]:~/Desktop$ python
Python 2.7.3 (default, Apr 10 2013, 05:13:16)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import re; print re
<module 're' from '/home/me/Desktop/testenv/lib/python2.7/re.pyc'> # OK!
>>> import logging; print logging
<module 'logging' from '/usr/lib/python2.7/logging/__init__.pyc'> # WHY?
FWIW,在MacOS上我没有任何本地复制模块,它们是“标准”python 3.5组的一部分。我想知道'--always-copy'选项在这里会有帮助吗? –
我试着用virtualenv来试试你的建议:'$ virtualenv --always-copy testenv'但结果是一样的。 – obk
看到你的评论 - '--always-copy'只是复制* certain *文件,而不是将它们混合。它并没有全部复制它们。你为什么要将日志记录复制到virtualenv?记录你想要的特别之处是什么? –