运行Python程序,出现警告
UserWarning: Could not import the lzma module. Your installed Python is incomplete.
Attempting to use lzma compression will result in a RuntimeError.
warnings.warn(msg)
打开警告,将warnings注释掉,就不会每次出现警告了
def _import_lzma(): """ Importing the `lzma` module. Warns ----- When the `lzma` module is not available. """ try: import lzma return lzma except ImportError: msg = ( "Could not import the lzma module. " "Your installed Python is incomplete. " "Attempting to use lzma compression will result in a RuntimeError." ) # warnings.warn(msg)