【问题标题】:Getting error "No package 'libffi' found" when installing python-telegram-bot安装 python-telegram-bot 时出现错误“找不到包 'libffi'”
【发布时间】:2019-05-07 23:34:46
【问题描述】:

我试图在我的树莓派上安装 python-telegram-bot 但我遇到了这个问题:

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

【问题讨论】:

  • 这是整个错误信息吗?能否再检查一下是否还有更多错误信息。
  • 我无法在这里分享整个消息,所以我将其添加到谷歌文档中:docs.google.com/document/d/…
  • 您使用的是什么操作系统?你在使用 Raspbian Stretch 吗?
  • 是的,它的 raspbian-stretch-full

标签: python raspberry-pi python-telegram-bot


【解决方案1】:

看来主要问题是这样的:

  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

如果您在无法使用apt 的非标准操作系统(不是Raspbian)上,您可以直接从Debian 手动下载并安装libffi-dev 文件或从@ 自己构建它987654322@.

【讨论】:

    猜你喜欢
    • 2019-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-17
    • 2017-11-07
    • 1970-01-01
    • 1970-01-01
    • 2020-12-18
    • 2018-05-14
    相关资源
    最近更新 更多