首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装python-telegram-bot时出现错误"No package 'libffi‘found“

安装python-telegram-bot时出现错误"No package 'libffi‘found“
EN

Stack Overflow用户
提问于 2019-05-08 07:34:47
回答 1查看 7.5K关注 0票数 2

我试图在我的覆盆子pi上安装python-telegram-bot,但我遇到了这个问题:

代码语言:javascript
复制
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/

我尝试了这个命令,但是我得到了同样的问题:

代码语言:javascript
复制
pip install python-telegram-bot==12.0.0b1 --upgrade 
pip install python-telegram-bot --upgrade
python -m pip install python-telegram-bot
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-05-08 11:18:07

看起来主要的问题是:

代码语言:javascript
复制
  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,而CFFI需要libffi

请先尝试安装libffi

代码语言:javascript
复制
$ sudo apt-get update
$ sudo apt-get install libffi-dev

如果您使用的是不能使用apt的非标准操作系统(不是Raspbian),那么您可以直接从Debian手动下载并安装libffi-dev文件,或者从OpenEmbedded自行构建它。

票数 7
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56031697

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档