cffi Python包版本不匹配的错误。

4
我正在尝试安装一个Python软件(https://github.com/GuLinux/AstroPhoto-Plus),但在执行安装后的日志中遇到了这个错误:
Exception: Version mismatch: this is the 'cffi' package version 1.14.6, located in '/tmp/pip-build-env-kuxyuc2x/overlay/lib/python3.8/site-packages/cffi/api.py'.  
When we import the top-level '_cffi_backend' extension module, we get version 1.14.0, located in '/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-arm-linux-gnueabihf.so'.  The two versions should be equal; check your installation.

据我所知,我有:

hamham@astroloutre:~/www$ pip show cffi
Name: cffi
Version: 1.14.0
Summary: Foreign Function Interface for Python calling C code.
Home-page: http://cffi.readthedocs.org
Author: Armin Rigo, Maciej Fijalkowski
Author-email: python-cffi@googlegroups.com
License: MIT
Location: /home/hamham/.local/lib/python3.8/site-packages
Requires: pycparser
Required-by: 

我正在尝试安装1.14.6版本。

hamham@astroloutre:~/www$ pip install --upgrade cffi==1.14.6
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Processing /home/hamham/.cache/pip/wheels/21/a9/81/c074a48686fe8c1ffada1f9e5f53b553c0f766503c0b991c23/cffi-1.14.6-cp38-cp38-linux_armv7l.whl
Requirement already satisfied, skipping upgrade: pycparser in /home/hamham/.local/lib/python3.8/site-packages (from cffi==1.14.6) (2.20)
Installing collected packages: cffi
  Attempting uninstall: cffi
    Found existing installation: cffi 1.14.0
    Uninstalling cffi-1.14.0:
      Successfully uninstalled cffi-1.14.0
Successfully installed cffi-1.14.6

hamham@astroloutre:~/www$ pip show cffi
Name: cffi
Version: 1.14.6
Summary: Foreign Function Interface for Python calling C code.
Home-page: http://cffi.readthedocs.org
Author: Armin Rigo, Maciej Fijalkowski
Author-email: python-cffi@googlegroups.com
License: MIT
Location: /home/hamham/.local/lib/python3.8/site-packages
Requires: pycparser
Required-by: 

重新安装后仍出现同样的错误:

 Exception: Version mismatch: this is the 'cffi' package version 1.14.6, located in '/tmp/pip-build-env-34pknb8l/overlay/lib/python3.8/site-packages/cffi/api.py'.  When we import the top-level '_cffi_backend' extension module, we get version 1.14.0, located in '/usr/lib/python3/dist-packages/_cffi_backend.cpython-38-arm-linux-gnueabihf.so'.  The two versions should be equal; check your installation.

我不是Python开发人员,尽管我在GitHub上发布了一个问题,但没有得到回答(似乎自一年前以来该代码库就被遗弃了),我不知道该怎么办。

谢谢。

1个回答

4

通过安装 "python3-cffi" 包来解决问题。

sudo apt install python3-cffi

降级pip软件包:

pip install --upgrade cffi==1.14.0

1
这对我在cffi 1.15.x上起作用。记下apt正在安装的版本,并强制pip使用相同的版本。 - simonpa71
1
错误:命令'/usr/bin/x86_64-linux-gnu-gcc'失败,退出代码为1 [输出结束] 注意:此错误源自子进程,可能与pip无关。 错误:传统安装失败 - saber tabatabaee yazdi

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接