我在我的 python 源代码中使用记录器,并想在特定位置创建日志,但python 日志记录模块在默认位置创建日志文件,即从它执行的位置。
有没有办法改变这个默认位置?
下面是我的配置
import logging
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG, format='%(asctime)s %(levelname)-8s %(message)s', datefmt='%a, %d %b %Y %H:%M:%S', filename='testGene.log, filemode='w')
Run Code Online (Sandbox Code Playgroud) sqlite与python 2.7工作正常,但是当我尝试在python 3中导入它时,它会出错
> Traceback (most recent call last): File "dbConnection.py", line 1,
> in <module>
> import sqlite3 File "/usr/local/lib/python3.4/sqlite3/__init__.py", line 23, in <module>
> from sqlite3.dbapi2 import * File "/usr/local/lib/python3.4/sqlite3/dbapi2.py", line 27, in <module>
> from _sqlite3 import * ImportError: No module named '_sqlite3'
Run Code Online (Sandbox Code Playgroud)
删除此错误我试图重新安装sqlite3
sudo apt-get install sqlite3
Run Code Online (Sandbox Code Playgroud)
但它说包已经存在.之后我试图安装它
pip3 install sqlite3
Run Code Online (Sandbox Code Playgroud)
但是再次安装时会出错
Collecting sqlite3
Retrying (Retry(total=4, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', error('Tunnel connection failed: 407 Proxy Authentication Required',))': /simple/sqlite3/
Retrying …Run Code Online (Sandbox Code Playgroud)