通过pip更新pycups时出错

时间:2015-12-02 10:16:36

标签: python pip

我正在运行openSUSE Leap 42.1,我只是尝试使用以下命令更新pip中的所有软件:

for i in $(pip list|awk '{print $1}'); do pip install $i --upgrade;done

这遇到了一些错误,我有一些缺失的devel依赖项,我设法修复了,大多数软件包然后更新了,但是一个继续失败,我不知道为什么。此时的错误变得有点神秘,我的google-fu无法找到答案。任何人都可以建议我为什么会收到此错误,以及是否有办法解决/解决问题?

Collecting pycups
  Using cached pycups-1.9.73.tar.bz2
Installing collected packages: pycups
  Found existing installation: pycups 1.9.72
    DEPRECATION: Uninstalling a distutils installed project (pycups) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
    Uninstalling pycups-1.9.72:
      Successfully uninstalled pycups-1.9.72
  Running setup.py install for pycups
    Complete output from command /usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vpyfl_ln/pycups/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zukh_f21-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'cups' extension
    creating build
    creating build/temp.linux-x86_64-3.4
    gcc -pthread -Wno-unused-result -Werror=declaration-after-statement -DNDEBUG -fmessage-length=0 -grecord-gcc-switches -O2 -Wall -D_FORTIFY_SOURCE=2 -fstack-protector -funwind-tables -fasynchronous-unwind-tables -g -DOPENSSL_LOAD_CONF -fPIC -DVERSION="1.9.73" -I/usr/include/python3.4m -c cupsmodule.c -o build/temp.linux-x86_64-3.4/cupsmodule.o
    cupsmodule.c: In function ‘cups_connectDest’:
    cupsmodule.c:720:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
       int i;
       ^
    cupsmodule.c:743:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
       PyObject *largs = Py_BuildValue ("()");
       ^
    cupsmodule.c: In function ‘PyInit_cups’:
    cupsmodule.c:1018:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
       struct module_state *st = GETSTATE(m);
       ^
    cupsmodule.c:1026:3: error: ISO C90 forbids mixed declarations and code [-Werror=declaration-after-statement]
       PyObject *d = PyModule_GetDict (m);
       ^
    cc1: some warnings being treated as errors
    error: command 'gcc' failed with exit status 1

    ----------------------------------------
  Rolling back uninstall of pycups
Command "/usr/bin/python3 -c "import setuptools, tokenize;__file__='/tmp/pip-build-vpyfl_ln/pycups/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-zukh_f21-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-vpyfl_ln/pycups

我正在使用以下点:

pip 7.1.2 from /usr/lib/python3.4/site-packages (python 3.4)

1 个答案:

答案 0 :(得分:2)

问题是这个编译器标志:-Werror=declaration-after-statement。您需要通过设置CFLAGS环境变量来告诉编译器不要将此警告变为错误:

CFLAGS=-Wno-error=declaration-after-statement pip install -U pycups