安装python包 - 没有日志记录配置

时间:2014-01-30 21:05:03

标签: python

我刚刚安装了一个名为“Bacon”的python包,但每当我导入它时,都会出现一些错误。

错误:

WARNING: No logging configuration for "bacon" set; using default
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import bacon
  File "F:\Program Files (x86)\Python\lib\site-packages\bacon\__init__.py", line 4, in <module>
    from bacon.all import *
  File "F:\Program Files (x86)\Python\lib\site-packages\bacon\all.py", line 1, in <module>
    from bacon.core import *
  File "F:\Program Files (x86)\Python\lib\site-packages\bacon\core.py", line 152, in <module>
    lib = native.load(function_wrapper = _error_wrapper)
  File "F:\Program Files (x86)\Python\lib\site-packages\bacon\native.py", line 493, in load
    _lib = _dll_path.get_lib()
  File "F:\Program Files (x86)\Python\lib\site-packages\bacon\native.py", line 428, in get_lib
    dll_dir = self.get_dir()
  File "F:\Program Files (x86)\Python\lib\site-packages\bacon\native.py", line 396, in get_dir
    _pkg_resources = __import__('pkg_resources', globals(), locals(), [], -1)
ValueError: level must be >= 0

如何解决这个问题?为什么要这样做?

由于

2 个答案:

答案 0 :(得分:0)

主模块中的

在开头就像

一样
import logging
logging.basicConfig(logging.INFO)

它进入默认的日志记录配置并设置级别..

答案 1 :(得分:0)

如果您有权限,请更改此行(文件&#34; F:\ Program Files(x86)\ Python \ lib \ site-packages \ bacon \ native.py&#34;,第396行):

_pkg_resources = __import__('pkg_resources', globals(), locals(), [], -1)

_pkg_resources = __import__('pkg_resources', globals(), locals(), [], 0)

level指的是最后一个参数。

Documentation

  

版本3.3中更改:不再支持级别的负值(这也将默认值更改为0)。