我正在尝试在我的 python 代码中使用 glog,当我尝试导入时,它会引发以下错误:
/usr/local/lib/python2.7/dist-packages/glog.py:171: RuntimeWarning:
Trying to access flag verbosity before flags were parsed. This will raise
an exception in the future.
setLevel(FLAGS.verbosity)
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/glog.py", line 171, in
<module>
setLevel(FLAGS.verbosity)
File "/usr/local/lib/python2.7/dist-packages/gflags/flagvalues.py", line
390, in __getattr__
traceback.print_stack()
E0602 09:45:07.674463 4695 flagvalues.py:399] Trying to access flag
verbosity before flags were parsed.
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/gflags/flagvalues.py", line
391, in __getattr__
raise exceptions.UnparsedFlagAccessError(error_message)
UnparsedFlagAccessError: Trying to access flag verbosity before
flags were parsed.
我的代码如下。
import gflags
import glog as log
我在网上搜索过,但没有任何关于 glog 的 python 版本的信息。我认为这个错误必须与 gflags 和 glog 一起做。谁能解释一下出了什么问题?