pip3 使用问题小记

2023-05-16

1. Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-sj03j16p/lxml/

# pip3 install lxml
Collecting lxml
  Using cached https://files.pythonhosted.org/packages/2c/4d/3ec1ea8512a7fbf57f02dee3035e2cce2d63d0e9c0ab8e4e376e01452597/lxml-4.5.2.tar.gz
    Complete output from command python setup.py egg_info:
    Building lxml version 4.5.2.
    Building without Cython.
    Error: Please make sure the libxml2 and libxslt development packages are installed.
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-install-sj03j16p/lxml/
 

解决办法:

sudo -H pip3 install gitsome

2.c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory

pip3制作本地源过程中报错

pip3 freeze > requirements.txt 

pip3 download -r requirements.txt -d ./pkg/
Looking in indexes: https://mirrors.aliyun.com/pypi/simple/
Collecting asn1crypto==0.24.0 (from -r requirements.txt (line 1))
  File was already downloaded /root/pkg/asn1crypto-0.24.0-py2.py3-none-any.whl
    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 -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.7m -c c/_cffi_backend.c -o build/temp.linux-aarch64-3.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
              ^~~~~~~
    compilation terminated.
    error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
Command "/usr/bin/python3 -m pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-xtg_l7y4 --no-warn-script-location --no-binary :none: --only-binary :none: -i https://mirrors.aliyun.com/pypi/simple/ -- setuptools>=18.5 wheel "cffi>=1.8,!=1.11.3; python_implementation != 'PyPy'"" failed with error code 1 in None
 

解决办法:

apt install libffi-dev

3. cairo/device.c:30:10: fatal error: Python.h: No such file or directory

 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 -DPYCAIRO_VERSION_MAJOR=1 -DPYCAIRO_VERSION_MINOR=19 -DPYCAIRO_VERSION_MICRO=1 -I/usr/include/cairo -I/usr/include/glib-2.0 -I/usr/lib/aarch64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng16 -I/usr/include/uuid -I/usr/include/python3.7m -c cairo/device.c -o build/temp.linux-aarch64-3.7/cairo/device.o -Wall -Warray-bounds -Wcast-align -Wconversion -Wextra -Wformat=2 -Wformat-nonliteral -Wformat-security -Wimplicit-function-declaration -Winit-self -Winline -Wmissing-format-attribute -Wmissing-noreturn -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith -Wreturn-type -Wshadow -Wsign-compare -Wstrict-aliasing -Wundef -Wunused-but-set-variable -Wswitch-default -Wno-missing-field-initializers -Wno-unused-parameter -Wno-unused-command-line-argument -fno-strict-aliasing -fvisibility=hidden -std=c99
    cairo/device.c:30:10: fatal error: Python.h: No such file or directory
     #include <Python.h>
              ^~~~~~~~~~
    compilation terminated.
    error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-npxeyr96/pycairo/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-ak5ywsy4/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-npxeyr96/pycairo/

解决:

ubuntu/uos:

apt install python3-dev

centos:

yum install -y python3-devel
4. uild/temp.linux-aarch64-3.7/_openssl.c:575:10: fatal error: openssl/opensslv.h: No such file or directory

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 -I/usr/include/python3.7m -c build/temp.linux-aarch64-3.7/_openssl.c -o build/temp.linux-aarch64-3.7/build/temp.linux-aarch64-3.7/_openssl.o -Wconversion -Wno-error=sign-conversion
  build/temp.linux-aarch64-3.7/_openssl.c:575:10: fatal error: openssl/opensslv.h: No such file or directory
   #include <openssl/opensslv.h>
            ^~~~~~~~~~~~~~~~~~~~
  compilation terminated.
  error: command 'aarch64-linux-gnu-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for cryptography
  Running setup.py clean for cryptography
  Running setup.py bdist_wheel for cffi ... error

解决:

ubuntu/uos:

apt install libssl-dev

centos:

yum install -y openssl-devel

5. No package 'cairo-gobject' found

No package 'cairo-gobject' found
    Command '('pkg-config', '--print-errors', '--exists', 'cairo-gobject >= 0')' returned non-zero exit status 1.
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-24pj94sg/PyGObject/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-3ydih3d4-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-24pj94sg/PyGObject/

解决:

centos:

yum install -y python3-devel

yum install -y cairo-devel

yum install -y gobject-introspection-devel

yum install -y cairo-gobject-devel

 

 

 

 

 

 

 

 

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

pip3 使用问题小记 的相关文章

随机推荐