No module named _cffi_backend

2020-06-07 03:34发布

I have python2.6 in my Linux rhel-5. I have installed pip and required CFFI packages. When i try to run a sample CFFI program it says :

ffi = FFI()

File "/usr/lib/python2.6/site-packages/cffi/api.py", line 56, in init

import _cffi_backend as backend

ImportError: No module named _cffi_backend

what could be the posiible error. Did i miss something during install. i have installed pip, wheel, pycparser, pytest, cffi....

标签: python-2.6
10条回答
倾城 Initia
2楼-- · 2020-06-07 04:05

You could look at the code L56 in /usr/lib/python2.6/site-packages/cffi/api.py

It needs the _cffi_backend.so in your pythonpath. You could install the python-cffi for it. But not sure whether it is in your RPM repo, especially you are using RHEL-5. Here is an RPM for CENTOS http://cbs.centos.org/koji/rpminfo?rpmID=20613 Hope it helps. I am still searching the source code for building the _cffi_backend.so.

查看更多
地球回转人心会变
3楼-- · 2020-06-07 04:11

Have the same problem. After many attempts adding import cffi solve the issue.

Make sure you have cffi and cryptography installed.

查看更多
我想做一个坏孩纸
4楼-- · 2020-06-07 04:12

You have to first remove the following packages:

cryptography
bcrypt
paramiko

Now use the following command to install:

pip -vvv install --upgrade --force-reinstall cffi
查看更多
▲ chillily
5楼-- · 2020-06-07 04:16

For python2.x use following command:

python -m pip install cffi

for python3.x

python3 -m pip install cffi
查看更多
ゆ 、 Hurt°
6楼-- · 2020-06-07 04:17

I recently had the same issue and none of the above solutions worked for me.

Here is what worked.

sudo apt remove python3-cffi
sudo python3 -m pip install cffi
查看更多
疯言疯语
7楼-- · 2020-06-07 04:20

You should do install cffi pip install cffi to get the latest version. I had to restart my application for it to recognize the cffi installation.

查看更多
登录 后发表回答