pip install python-lzo失败了

时间:2018-02-22 19:33:33

标签: python docker pip

目前尝试在任何环境中运行pip install python-lzo都失败了(我尝试了三种不同的机器:ubuntu 16.04,macosx和基于python的docker容器内部:2.7):

Collecting python-lzo
  Downloading python-lzo-1.11.tar.gz
Building wheels for collected packages: python-lzo
  Running setup.py bdist_wheel for python-lzo ... error
  Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/tmp4XTk5Ipip-wheel- --python-tag cp27:
  /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
    warnings.warn(msg)
  running bdist_wheel
  running build
  running build_ext
  building 'lzo' extension
  creating build
  creating build/temp.macosx-10.11-x86_64-2.7
  clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/lzo -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lzomodule.c -o build/temp.macosx-10.11-x86_64-2.7/lzomodule.o
  lzomodule.c:35:10: fatal error: 'lzo1x.h' file not found
  #include <lzo1x.h>
           ^
  1 error generated.
  error: command 'clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for python-lzo
  Running setup.py clean for python-lzo
Failed to build python-lzo
Installing collected packages: python-lzo
  Running setup.py install for python-lzo ... error
    Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-iXLv5I-record/install-record.txt --single-version-externally-managed --compile:
    /usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:251: UserWarning: 'licence' distribution option is deprecated; use 'license'
      warnings.warn(msg)
    running install
    running build
    running build_ext
    building 'lzo' extension
    creating build
    creating build/temp.macosx-10.11-x86_64-2.7
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/include/lzo -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c lzomodule.c -o build/temp.macosx-10.11-x86_64-2.7/lzomodule.o
    lzomodule.c:35:10: fatal error: 'lzo1x.h' file not found
    #include <lzo1x.h>
             ^
    1 error generated.
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-iXLv5I-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/2m/0shxv04j04lcm1c0dddyf4qw0000gn/T/pip-build-iOtvF1/python-lzo/

我真的想要构建一个运行它的docker容器:

RUN pip install python-lzo

有什么想法吗?谢谢!

2 个答案:

答案 0 :(得分:1)

您必须在debian基本映像中安装liblzo2-dev并在centos基本映像中安装lzo-devel

答案 1 :(得分:1)

使用以下Dockerfile修复此问题:

FROM ubuntu:16.04
RUN apt-get update && \
apt-get install -y python python-pip python-lzo zlib1g-dev unzip
RUN pip install bx-python

显然你可以直接通过apt安装python-lzo而不是使用pip? 叹息