zoukankan      html  css  js  c++  java
  • [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
    
  • 相关阅读:
    对Java面向对象的理解(笔记)
    java中switch语句实际的执行顺序;java中scanner输入为什么会被跳过;Java中scanner close方法慎用的问题;什么是方法
    面向对象编程思想 以及 封装,继承,多态 和 python中实例方法,类方法,静态方法 以及 装饰器
    python关于debug设置断点调试模式下无法命中断点的问题
    手把手教大家如何用scrapy爬虫框架爬取王者荣耀官网英雄资料
    python中可变长度参数详解
    爬虫如何使用phantomjs无头浏览器解决网页源代码经过渲染的问题(以scrapy框架为例)
    python如何通过正则表达式一次性提取到一串字符中所有的汉字
    Linux 输入输出(I/O)重定向
    Linux shell 通配符 / glob 模式
  • 原文地址:https://www.cnblogs.com/abeen/p/9355389.html
Copyright © 2011-2022 走看看