我有 python 3.5,试图在 PyCharm 中安装日志包,但出现错误:
安装包 'logging' 时出错 请确保您使用此包支持的 Python 版本。目前您使用的是 Python 3.5。
import logging
logging.warning('Watch out!')
logging.info('I told you so')
Run Code Online (Sandbox Code Playgroud)
更新:
如果包括为什么我得到这个:
Traceback (most recent call last):
File "C:/Users/alotfi/PycharmProjects/firstProj/logging.py", line 1, in <module>
import logging
File "C:\Users\alotfi\PycharmProjects\firstProj\logging.py", line 2, in <module>
logging.warning('Watch out!')
AttributeError: module 'logging' has no attribute 'warning'
Process finished with exit code 1
Run Code Online (Sandbox Code Playgroud)
谢谢。
Logging 是python 3.5的标准包,这意味着没有理由安装它。