【问题标题】:Cannot install pycups with pip because of cups/cups.h not found由于未找到 cups/cups.h,无法使用 pip 安装 pycups
【发布时间】:2014-07-02 18:30:03
【问题描述】:

我正在尝试使用 pip 在隔离 (--no-site-package) virtualenv 中安装 pycups,并且我正在获取此回溯。我无法弄清楚我做错了什么。有什么想法吗?

谢谢,

Downloading/unpacking pycups
  Running setup.py egg_info for package pycups

Installing collected packages: pycups
  Running setup.py install for pycups
    building 'cups' extension
    gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DVERSION="1.9.66" -I/usr/include/python2.7 -c cupsmodule.c -o build/temp.linux-x86_64-2.7/cupsmodule.o
    cupsmodule.c:23:23: fatal error: cups/cups.h: El fitxer o directori no existeix
    compilation terminated.
    error: command 'gcc' failed with exit status 1
    Complete output from command /home/jmartin/workspace/trytond/bin/python -c "import setuptools;__file__='/home/jmartin/workspace/trytond/build/pycups/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-NbMOAM-record/install-record.txt --single-version-externally-managed --install-headers /home/jmartin/workspace/trytond/include/site/python2.7:
    running install

running build

running build_ext

building 'cups' extension

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DVERSION="1.9.66" -I/usr/include/python2.7 -c cupsmodule.c -o build/temp.linux-x86_64-2.7/cupsmodule.o

cupsmodule.c:23:23: fatal error: cups/cups.h: El fitxer o directori no existeix

compilation terminated.

error: command 'gcc' failed with exit status 1

----------------------------------------
Command /home/jmartin/workspace/trytond/bin/python -c "import setuptools;__file__='/home/jmartin/workspace/trytond/build/pycups/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-NbMOAM-record/install-record.txt --single-version-externally-managed --install-headers /home/jmartin/workspace/trytond/include/site/python2.7 failed with error code 1 in /home/jmartin/workspace/trytond/build/pycups
Storing complete log in /home/jmartin/.pip/pip.log

Python 版本:

$ python --version
Python 2.7.3

GCC 版本:

$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.6/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.6.3-1ubuntu5' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.6 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --disable-werror --with-arch-32=i686 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 4.6.3 (Ubuntu/Linaro 4.6.3-1ubuntu5) 

【问题讨论】:

    标签: linux python-2.7 virtualenv


    【解决方案1】:

    我在 ubuntu 14.04 上重现了这个错误,如果你安装 libcups2-dev,它应该可以工作:

    sudo apt-get install libcups2-dev

    这似乎适用于最新的当前版本 (20.04)。

    【讨论】:

    • 你是一个救生员。谢谢
    • 在 Ubuntu 19.10 中相同
    • 确认修复了 Raspbian Buster, Python 3 上的相同问题
    • 也适用于 20.04
    • 工作就像一个魅力!谢谢你
    猜你喜欢
    • 1970-01-01
    • 2022-07-14
    • 1970-01-01
    • 2020-05-26
    • 2021-06-01
    • 1970-01-01
    • 2021-12-29
    • 2019-02-27
    • 2018-07-27
    相关资源
    最近更新 更多