的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?記錄你想要的特別之處是什麼? –