[英]Package libffi was not found in the pkg-config search path REDHAT6.5
I am trying to run setup.py related to a proprietary software installation and it has dependencies on libffi.我正在尝试运行与专有软件安装相关的 setup.py,它依赖于 libffi。
Since its Redhat 6.5 the python version was 2.6 and i installed python 2.7.由于它的 Redhat 6.5,python 版本是 2.6,我安装了 python 2.7。
libffi was already installed and when i create a virtualenv and try installing the software by running the setup.py i get the following error: libffi 已经安装,当我创建一个 virtualenv 并尝试通过运行 setup.py 安装软件时,我收到以下错误:
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
c/_cffi_backend.c:15:17: error: ffi.h: No such file or directory
In file included from c/_cffi_backend.c:63:
yum list libffi
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed Packages
libffi.x86_64 3.0.5-3.2.el6 @anaconda-RedHatEnterpriseLinux-201311111358.x86_64/6.5
Available Packages
libffi.i686 3.0.5-3.2.el6 rhel-local
My query is how do we modify the pkg-config search path.我的问题是我们如何修改 pkg-config 搜索路径。 to point to libffi.pc?指向libffi.pc?
安装后试试:
sudo apt-get install libffi6 libffi-dev
You will need the development version of libffi to install libraries which depends on libffi :您将需要 libffi 的开发版本来安装依赖于 libffi 的库:
sudo yum install libffi-devel
This worked for me这对我有用
I had the same issue for MacOS.我对 MacOS 也有同样的问题。 I assume the solution should be similar.我认为解决方案应该是相似的。
nano ~/.bash_profile
Add these two lines below to the end of your bash_profile so that it can be discovered将下面这两行添加到 bash_profile 的末尾,以便可以发现它
export PKG_CONFIG_PATH="/usr/local/opt/libffi/lib/pkgconfig"
export LDFLAGS="-L/usr/local/opt/libffi/lib"
Save and quit and restart Terminal保存并退出并重新启动终端
Faced a similar issue while installing paramiko using pip3:使用 pip3 安装 paramiko 时遇到类似问题:
$ pip3 install paramiko $ pip3 安装 paramiko
ERROR:错误:
Package libffi was not found in the pkg-config search path.在 pkg-config 搜索路径中找不到软件包 libffi。 Perhaps you should add the directory containing `libffi.pc' to the PKG_CONFIG_PATH environment variable No package 'libffi' found也许您应该将包含 `libffi.pc' 的目录添加到 PKG_CONFIG_PATH 环境变量中没有找到包 'libffi'
No package 'libffi' found c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory compilation terminated.找不到包'libffi' c/_cffi_backend.c:15:17:致命错误:ffi.h:没有此类文件或目录编译终止。
distutils.errors.DistutilsExecError: command 'x86_64-linux-gnu-gcc' failed with exit status 1 distutils.errors.DistutilsExecError:命令“x86_64-linux-gnu-gcc”失败,退出状态为 1
RESOLUTION:解析度:
$ sudo apt-get install libffi-dev
$ pip3 install paramiko
Successfully installed asn1crypto bcrypt cffi cryptography-1.2.3 paramiko-1.16.0 pycparser pynacl six-1.10.0安装成功 asn1crypto bcrypt cffi cryptography-1.2.3 paramiko-1.16.0 pycparser pynacl 6-1.10.0
In my case libffi was not installed. 在我的情况下,没有安装libffi 。 So the below command fixed the issue. 所以下面的命令修复了这个问题。
sudo apt-get install libffi6 libffi-dev
Thanks to Harun-Ur-Rashid 感谢Harun-Ur-Rashid
I was using python 3.8 and getting the same error while wheel was trying to setup cffi on a conda environment.我正在使用 python 3.8 并在 wheel 尝试在 conda 环境中设置 cffi 时遇到相同的错误。 I tried installing libffi and libffi-dev (and exiting the terminal and reactivating the environment each time was installing something!) but with no luck.我尝试安装 libffi 和 libffi-dev (每次退出终端并重新激活环境都在安装一些东西!)但没有运气。 I then thought that maybe downgrading python to 3.7 might solve the issue.然后我想也许将 python 降级到 3.7 可能会解决这个问题。 I did that in my conda environment (just activated the environment and ran conda install python=3.7 and then all of the sudden libffi was found! wheel was able to setup cffi and all were working like a charm!我在我的 conda 环境中做到了这一点(刚刚激活环境并运行 conda install python=3.7 然后突然发现 libffi!wheel 能够设置 cffi 并且一切都像魅力一样工作!
尝试这个
sudo apt-get install -y python3-cffi
I got the same error from docker build.我从 docker build 得到了同样的错误。 So I added just below command in my Dockerfile and solved my issue.所以我在我的 Dockerfile 中添加了下面的命令并解决了我的问题。
PS: my base image is alpine-linux PS:我的基础镜像是 alpine-linux
RUN apk update \
&& apk --no-cache --update add libffi-dev
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.