cffi 安装报错“c/_cffi_backend.oc/_cffi_backend.c:15:17: error: ffi.h: No such file or directory”问题

在powerlinux6.4环境下安装cffi-1.11.5时遇到错误,提示libffi未找到。解决方法是将包含libffi.pc的目录添加到PKG_CONFIG_PATH环境变量中,然后重新执行安装命令,最终在python/lib64目录下成功完成安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

cffi安装问题

环境:powerlinux6.5-64
安装:
1. 解压cffi-1.11.5.tar.gz
2. 进入cffi目录

   cd cffi-1.11.5
   python setup.py install
  1. 报错信息如下:
[root@localhost cffi-1.11.5]# /opt/python-powerlinux6-64/bin/python setup.py install
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
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
running install
running bdist_egg
running egg_info
writing requirements to cffi.egg-info/requires.txt
writing cffi.egg-info/PKG-INFO
writing top-level names to cffi.egg-info/top_level.txt
writing dependency_links to cffi.egg-info/dependency_links.txt
writing entry points to cffi.egg-info/entry_points.txt
reading manifest file 'cffi.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
writing manifest file 'cffi.egg-info/SOURCES.txt
installing library code to build/bdist.linux-ppc64/egg
running install_lib
running build_py
running build_ext
building '_cffi_backend' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/includ
e/libffi -I/opt/python-powerlinux6-64/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-ppc64-2.7/c/_cffi_backend.oc/_cffi_backend.c:15:17: error: ffi.h: No such file or directory
In file included from c/_cffi_backend.c:92:
c/malloc_closure.h:81: error: expected specifier-qualifier-list before ‘ffi_closure’
c/malloc_closure.h: In function ‘more_core’:
c/malloc_closure.h:117: warning: division by zero
c/malloc_closure.h:149: error: ‘union mmaped_block’ has no member named ‘next’
c/malloc_closure.h: At top level:

从提示中可以看出: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
可以看出是编译时缺少libffi.pc, 找出libffi.pc的的目录,

#### libffi 未安装
安装libffi编译安装即可:

[root@localhost cffi-1.11.5]# export PKG_CONFIG_PATH=/opt/python-powerlinux6-64/lib/pkgconfig/

重新执行:python setup.py install 安装即可成功
在编译python/lib64中即可成功找到

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值