[Dynamic Language] Python3.7 源码安装 ModuleNotFoundError: No module named '_ctypes' 解决记录...

Python3.7 源码安装 ModuleNotFoundError: No module named '_ctypes' 解决记录

源码安装时报错

File "/home/abeenserver/netsource/Python-3.7.0/Lib/ctypes/__init__.py", line 7, in <module>
    from _ctypes import Union, Structure, Array
ModuleNotFoundError: No module named '_ctypes'
Makefile:1122: recipe for target 'install' failed
make: *** [install] Error 1

解决记录

  • 1 安装依赖包 libffi-dev
abeenserver@abeenserver:~/netsource/Python-3.7.0$ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libffi-dev : Depends: libffi6 (= 3.2.1-4) but 3.2.1-8 is to be installed
E: Unable to correct problems, you have held broken packages.
  • 2 看来libffi-dev 依赖的libffi6版本,本地版本有点高了,还是安装后退安装指定依赖包 libffi6=3.2.1-4 吧
abeenserver@abeenserver:~/netsource/Python-3.7.0$ sudo apt-get install libffi6=3.2.1-4
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following packages will be DOWNGRADED:
  libffi6
0 upgraded, 0 newly installed, 1 downgraded, 0 to remove and 0 not upgraded.
Need to get 17.8 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] Y
Get:1 http://mirrors.ustc.edu.cn/ubuntu xenial/main amd64 libffi6 amd64 3.2.1-4 [17.8 kB]
Fetched 17.8 kB in 2s (9,110 B/s)
dpkg: warning: downgrading libffi6:amd64 from 3.2.1-8 to 3.2.1-4
(Reading database ... 109533 files and directories currently installed.)
Preparing to unpack .../libffi6_3.2.1-4_amd64.deb ...
Unpacking libffi6:amd64 (3.2.1-4) over (3.2.1-8) ...
Setting up libffi6:amd64 (3.2.1-4) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
  • 3 再次尝试安装 libffi-dev,成功
abeenserver@abeenserver:~/netsource/Python-3.7.0$ sudo apt-get install libffi-dev
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following NEW packages will be installed:
  libffi-dev
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 161 kB of archives.
After this operation, 365 kB of additional disk space will be used.
Get:1 http://mirrors.ustc.edu.cn/ubuntu xenial/main amd64 libffi-dev amd64 3.2.1-4 [161 kB]
Fetched 161 kB in 0s (434 kB/s)
Selecting previously unselected package libffi-dev:amd64.
(Reading database ... 109533 files and directories currently installed.)
Preparing to unpack .../libffi-dev_3.2.1-4_amd64.deb ...
Unpacking libffi-dev:amd64 (3.2.1-4) ...
Processing triggers for install-info (6.5.0.dfsg.1-2) ...
Setting up libffi-dev:amd64 (3.2.1-4) ...
Processing triggers for man-db (2.8.3-2) ...
  • 4 继续配置安装Python3.7,顺利完成!
./configure --enable-shared --enable-loadable-sqlite-extensions --enable-optimizations
make
make test
sudo make install

转载于:https://www.cnblogs.com/abeen/p/9355389.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值