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天前
export 与 import | ES6
export 与 import | ES6
15 0
export 与 import | ES6
|
6天前
|
JavaScript 前端开发
ES6之Module:export、import
ES6之Module:export、import
|
6月前
from pymdownx import superfences No module named ‘pymdownx‘
from pymdownx import superfences No module named ‘pymdownx‘
58 0
|
Docker Python 容器
解决ModuleNotFoundError: No module named ‘distutils.util‘
解决ModuleNotFoundError: No module named ‘distutils.util‘
702 0
No module factory available for dependency type: ModuleHotAcceptDependency
No module factory available for dependency type: ModuleHotAcceptDependency
290 0
|
10月前
|
Python
【已解决!】ImportError: cannot import name ‘ProjectModelSerializer‘ from partially initialized module ‘pr
【已解决!】ImportError: cannot import name ‘ProjectModelSerializer‘ from partially initialized module ‘pr
|
11月前
|
前端开发
Module理解及使用
Module理解及使用
84 0
|
Python
ModuleNotFoundError: No module named 'utils'
ModuleNotFoundError: No module named 'utils'
833 0
ModuleNotFoundError: No module named ‘distutils.util‘
ModuleNotFoundError: No module named ‘distutils.util‘
135 0