Python教程

【Python】解决pip install pycups -U失败的问题

本文主要是介绍【Python】解决pip install pycups -U失败的问题,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

升级pycups,失败了

$ pip install pycups -U
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://www.piwheels.org/simple
Requirement already satisfied: pycups in /usr/lib/python3/dist-packages (1.9.73)
Collecting pycups
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/0c/bb/82546806a86dc16f5eeb76f62ffdc42cce3d43aacd4e25a8b5300eec0263/pycups-2.0.1.tar.gz (62 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycups
  Building wheel for pycups (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/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'"'"'))' bdist_wheel -d /tmp/pip-wheel-gyipal1c
       cwd: /tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/
  Complete output (12 lines):
  running bdist_wheel
  running build
  running build_ext
  building 'cups' extension
  creating build
  creating build/temp.linux-aarch64-3.7
  aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="2.0.1" -I/usr/include/python3.7m -c cupsmodule.c -o build/temp.linux-aarch64-3.7/cupsmodule.o
  cupsmodule.c:24:10: fatal error: cups/cups.h: No such file or directory
   #include <cups/cups.h>
            ^~~~~~~~~~~~~
  compilation terminated.
  error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for pycups
  Running setup.py clean for pycups
Failed to build pycups
Installing collected packages: pycups
    Running setup.py install for pycups ... error
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/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-pn26h6oc/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/pi/.local/include/python3.7m/pycups
         cwd: /tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/
    Complete output (14 lines):
    running install
    /home/pi/.local/lib/python3.7/site-packages/setuptools/command/install.py:37: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
      setuptools.SetuptoolsDeprecationWarning,
    running build
    running build_ext
    building 'cups' extension
    creating build
    creating build/temp.linux-aarch64-3.7
    aarch64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DVERSION="2.0.1" -I/usr/include/python3.7m -c cupsmodule.c -o build/temp.linux-aarch64-3.7/cupsmodule.o
    cupsmodule.c:24:10: fatal error: cups/cups.h: No such file or directory
     #include <cups/cups.h>
              ^~~~~~~~~~~~~
    compilation terminated.
    error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python3 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-2gje3x3g/pycups_d2f734b80021412385c27416075694a2/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-pn26h6oc/install-record.txt --single-version-externally-managed --user --prefix= --compile --install-headers /home/pi/.local/include/python3.7m/pycups Check the logs for full command output.

安装libcups2-dev

$ sudo apt-get install libcups2-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libcupsfilters-dev libcupsimage2-dev libjbig-dev libjpeg-dev libjpeg62-turbo-dev liblzma-dev libtiff-dev libtiffxx5
Suggested packages:
  liblzma-doc
The following NEW packages will be installed:
  libcups2-dev libcupsfilters-dev libcupsimage2-dev libjbig-dev libjpeg-dev libjpeg62-turbo-dev liblzma-dev libtiff-dev libtiffxx5
0 upgraded, 9 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,549 kB of archives.
After this operation, 4,524 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://deb.debian.org/debian buster/main arm64 libjbig-dev arm64 2.1-3.1+b2 [28.3 kB]
Get:2 http://archive.raspberrypi.org/debian buster/main arm64 libcupsfilters-dev arm64 1.21.6-5+rpt1 [177 kB]
Get:3 http://deb.debian.org/debian buster/main arm64 libjpeg62-turbo-dev arm64 1:1.5.2-2+deb10u1 [195 kB]
Get:4 http://deb.debian.org/debian buster/main arm64 libjpeg-dev all 1:1.5.2-2+deb10u1 [57.7 kB]                                                                                                                                         
Get:5 http://deb.debian.org/debian buster/main arm64 liblzma-dev arm64 5.2.4-1 [209 kB]                                                                                                                                                  
Get:6 http://deb.debian.org/debian-security buster/updates/main arm64 libtiffxx5 arm64 4.1.0+git191117-2~deb10u3 [117 kB]                                                                                                                
Get:7 http://deb.debian.org/debian-security buster/updates/main arm64 libtiff-dev arm64 4.1.0+git191117-2~deb10u3 [384 kB]                                                                                                               
Get:8 http://deb.debian.org/debian buster/main arm64 libcupsimage2-dev arm64 2.2.10-6+deb10u4 [19.8 kB]                                                                                                                                  
Get:9 http://deb.debian.org/debian buster/main arm64 libcups2-dev arm64 2.2.10-6+deb10u4 [361 kB]                                                                                                                                        
Fetched 1,549 kB in 29s (53.5 kB/s)                                                                                                                                                                                                      
Selecting previously unselected package libjbig-dev:arm64.
(Reading database ... 95544 files and directories currently installed.)
Preparing to unpack .../0-libjbig-dev_2.1-3.1+b2_arm64.deb ...
Unpacking libjbig-dev:arm64 (2.1-3.1+b2) ...
Selecting previously unselected package libjpeg62-turbo-dev:arm64.
Preparing to unpack .../1-libjpeg62-turbo-dev_1%3a1.5.2-2+deb10u1_arm64.deb ...
Unpacking libjpeg62-turbo-dev:arm64 (1:1.5.2-2+deb10u1) ...
Selecting previously unselected package libjpeg-dev.
Preparing to unpack .../2-libjpeg-dev_1%3a1.5.2-2+deb10u1_all.deb ...
Unpacking libjpeg-dev (1:1.5.2-2+deb10u1) ...
Selecting previously unselected package liblzma-dev:arm64.
Preparing to unpack .../3-liblzma-dev_5.2.4-1_arm64.deb ...
Unpacking liblzma-dev:arm64 (5.2.4-1) ...
Selecting previously unselected package libtiffxx5:arm64.
Preparing to unpack .../4-libtiffxx5_4.1.0+git191117-2~deb10u3_arm64.deb ...
Unpacking libtiffxx5:arm64 (4.1.0+git191117-2~deb10u3) ...
Selecting previously unselected package libtiff-dev:arm64.
Preparing to unpack .../5-libtiff-dev_4.1.0+git191117-2~deb10u3_arm64.deb ...
Unpacking libtiff-dev:arm64 (4.1.0+git191117-2~deb10u3) ...
Selecting previously unselected package libcupsimage2-dev:arm64.
Preparing to unpack .../6-libcupsimage2-dev_2.2.10-6+deb10u4_arm64.deb ...
Unpacking libcupsimage2-dev:arm64 (2.2.10-6+deb10u4) ...
Selecting previously unselected package libcups2-dev:arm64.
Preparing to unpack .../7-libcups2-dev_2.2.10-6+deb10u4_arm64.deb ...
Unpacking libcups2-dev:arm64 (2.2.10-6+deb10u4) ...
Selecting previously unselected package libcupsfilters-dev:arm64.
Preparing to unpack .../8-libcupsfilters-dev_1.21.6-5+rpt1_arm64.deb ...
Unpacking libcupsfilters-dev:arm64 (1.21.6-5+rpt1) ...
Setting up libjbig-dev:arm64 (2.1-3.1+b2) ...
Setting up libjpeg62-turbo-dev:arm64 (1:1.5.2-2+deb10u1) ...
Setting up libcupsfilters-dev:arm64 (1.21.6-5+rpt1) ...
Setting up liblzma-dev:arm64 (5.2.4-1) ...
Setting up libtiffxx5:arm64 (4.1.0+git191117-2~deb10u3) ...
Setting up libjpeg-dev (1:1.5.2-2+deb10u1) ...
Setting up libtiff-dev:arm64 (4.1.0+git191117-2~deb10u3) ...
Setting up libcups2-dev:arm64 (2.2.10-6+deb10u4) ...
Setting up libcupsimage2-dev:arm64 (2.2.10-6+deb10u4) ...
Processing triggers for libc-bin (2.28-10+rpt2+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...

重试升级pycups,成功了

$ pip install pycups -U
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple, https://www.piwheels.org/simple
Requirement already satisfied: pycups in /usr/lib/python3/dist-packages (1.9.73)
Collecting pycups
  Using cached https://pypi.tuna.tsinghua.edu.cn/packages/0c/bb/82546806a86dc16f5eeb76f62ffdc42cce3d43aacd4e25a8b5300eec0263/pycups-2.0.1.tar.gz (62 kB)
  Preparing metadata (setup.py) ... done
Building wheels for collected packages: pycups
  Building wheel for pycups (setup.py) ... done
  Created wheel for pycups: filename=pycups-2.0.1-cp37-cp37m-linux_aarch64.whl size=226535 sha256=b76d72547e80daa9c16ec5ad1c45fdaee5fab491a08a9ec8074de9cc975bd264
  Stored in directory: /home/pi/.cache/pip/wheels/95/0d/00/287c5f50eb588a8d3d664d252198bdb0f558539843f70f1e89
Successfully built pycups
Installing collected packages: pycups
Successfully installed pycups-2.0.1
这篇关于【Python】解决pip install pycups -U失败的问题的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!