Kev*_*ong 5 ubuntu ctypes libffi python-3.x
当尝试在 Ubuntu 系统上以桌面模式安装 pgadmin4 时,我收到了 _ctypes 的 ModuleNotFoundError。
我做了一些研究,发现 _ctypes 需要安装 libffi-dev 包。然而,似乎 libffi-dev 和 _ctypes 是为 Python 2.7 安装的,当我运行 import ctypes 时,它似乎可以工作:
$ python2
Python 2.7.15+ (default, Nov 27 2018, 23:36:35)
[GCC 7.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
>>>
Run Code Online (Sandbox Code Playgroud)
当我尝试对 Python 3.7 执行相同操作时,它不起作用:
$ python
Python 3.7.3 (default, Jun 21 2019, 12:46:58)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ctypes
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.7/ctypes/__init__.py", line 7, in <module>
from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Run Code Online (Sandbox Code Playgroud)
如何将模块 _ctypes 添加到我的 Python 3.7 配置中?
小智 2
如果从源文件安装 python,则必须手动安装一些必需的软件包,如https://superuser.com/questions/1412975/how-to-build-and-install-python-3-7-x-from中所述-debian-9-8 上的源代码。
make实际上,由于未找到,您应该会看到一些错误libffi,如下面的屏幕截图所示。make install但是,尽管出现错误,您仍然可以运行。当你在安装后打开python并导入模块时,它会给出这样的错误。
要解决这个问题,可以先安装依赖包ielibffi或(redhat) ,如:
Package libffi was not found in the pkg-config search path REDHAT6.5 and
https://bugs.python.org/问题31652。libffi-devel./configuremakemake install
| 归档时间: |
|
| 查看次数: |
14374 次 |
| 最近记录: |