Linux上python安装backports.lzma报错

Linux上python安装backports.lzma报错

pip3.9 install backports.lzma
  • 报错信息:

Running setup.py install for backports.lzma … error
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3.9 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-pnrkhuf9/backports-lzma_24feded447a34e5a8b1c53cb80e10341/setup.py’"’"’; file=’"’"’/tmp/pip-install-pnrkhuf9/backports-lzma_24feded447a34e5a8b1c53cb80e10341/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-tcqknwy3/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/python3.9/include/python3.9/backports.lzma
cwd: /tmp/pip-install-pnrkhuf9/backports-lzma_24feded447a34e5a8b1c53cb80e10341/
Complete output (21 lines):
This is backports.lzma version 0.0.14
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.9
creating build/lib.linux-x86_64-3.9/backports
copying backports/init.py -> build/lib.linux-x86_64-3.9/backports
creating build/lib.linux-x86_64-3.9/backports/lzma
copying backports/lzma/init.py -> build/lib.linux-x86_64-3.9/backports/lzma
running build_ext
building ‘backports.lzma._lzma’ extension
creating build/temp.linux-x86_64-3.9
creating build/temp.linux-x86_64-3.9/backports
creating build/temp.linux-x86_64-3.9/backports/lzma
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/usr/local/python3.9/include -I/root/include -I/opt/local/include -I/usr/local/include -I/usr/local/python3.9/include/python3.9 -c backports/lzma/_lzmamodule.c -o build/temp.linux-x86_64-3.9/backports/lzma/_lzmamodule.o
backports/lzma/_lzmamodule.c:115:10: fatal error: lzma.h: No such file or directory
#include <lzma.h>
^~~~~~~~
compilation terminated.
error: command ‘/usr/bin/gcc’ failed with exit code 1
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3.9 -u -c ‘import io, os, sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-pnrkhuf9/backports-lzma_24feded447a34e5a8b1c53cb80e10341/setup.py’"’"’; file=’"’"’/tmp/pip-install-pnrkhuf9/backports-lzma_24feded447a34e5a8b1c53cb80e10341/setup.py’"’"’;f = getattr(tokenize, ‘"’"‘open’"’"’, open)(file) if os.path.exists(file) else io.StringIO(’"’"‘from setuptools import setup; setup()’"’"’);code = f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ install --record /tmp/pip-record-tcqknwy3/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/python3.9/include/python3.9/backports.lzma Check the logs for full command output.

  • 解决方法:
apt install -y liblzma-dev #ubuntu
yum install -y xz-devel    #centos
  • 此时在执行pip3.9 install backports.lzma就没什么问题了
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值