Could not import the lzma module

简介: Could not import the lzma module

运行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)
相关文章
|
6月前
|
JavaScript 前端开发
ES6之Module:export、import
ES6之Module:export、import
from pymdownx import superfences No module named ‘pymdownx‘
from pymdownx import superfences No module named ‘pymdownx‘
106 0
|
Docker Python 容器
解决ModuleNotFoundError: No module named ‘distutils.util‘
解决ModuleNotFoundError: No module named ‘distutils.util‘
898 0
|
5月前
|
Python
【已解决】ModuleNotFoundError: No module named ‘DBUtils‘,from DBUtils.PooledDB import PooledDB,
【已解决】ModuleNotFoundError: No module named ‘DBUtils‘,from DBUtils.PooledDB import PooledDB,
246 0
Can‘t get attribute ‘SiLU‘ on <module ‘torch.nn.modules.activation‘
Can‘t get attribute ‘SiLU‘ on <module ‘torch.nn.modules.activation‘
【已解决!】ImportError: cannot import name ‘ProjectModelSerializer‘ from partially initialized module ‘pr
【已解决!】ImportError: cannot import name ‘ProjectModelSerializer‘ from partially initialized module ‘pr
|
前端开发
Module理解及使用
Module理解及使用
128 0
|
Python
ModuleNotFoundError: No module named 'utils'
ModuleNotFoundError: No module named 'utils'
1177 0