当尝试在我的 Ubuntu 系统上以桌面模式安装 pgadmin4 时,我收到了 _ctypes 的 ModuleNotFoundError。
我做了一些研究,发现 _ctypes 需要安装 libffi-dev 包。但是,似乎为 Python 2.7 安装了 libffi-dev 并因此安装了 _ctypes,当我运行 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
>>>
当我尝试对 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'
如何将模块 _ctypes 添加到我的 Python 3.7 配置中?