Получение ошибки «Не найден пакет« libffi »при установке python-telegram-bot» - PullRequest
0 голосов
/ 08 мая 2019

Я пытался установить python-telegram-bot на свой Raspberry Pi, но у меня возникла эта проблема:

Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-QLuRQr/cffi/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-1vjudm-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    ...
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-Ub3vap/python2.7-2.7.13=. -fstack-protector-strong -Wformat -Werror=format-security -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-armv7l-2.7/c/_cffi_backend.o
    c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
     #include <ffi.h>
                     ^
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-QLuRQr/cffi/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-1vjudm-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-QLuRQr/cffi/

Я попробовал эту команду, но у меня возникла та же проблема:

pip install python-telegram-bot==12.0.0b1 --upgrade 
pip install python-telegram-bot --upgrade
python -m pip install python-telegram-bot

1 Ответ

1 голос
/ 08 мая 2019

Кажется, основная проблема заключается в следующем:

  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found

Для того пакета Python, который вы устанавливаете, требуется CFFI, для которого требуется libffi.

Попробуйте сначала установить libffi:

$ sudo apt-get update
$ sudo apt-get install libffi-dev

Если у вас нестандартная ОС (не Raspbian), которую вы не можете использовать apt, вы можете вручную загрузить и установить файлы libffi-dev непосредственно из https://packages.debian.org/stretch/libffi-dev.

...