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
    
  • 相关阅读:
    业务领域建模Domain Modeling
    用例建模Use Case Modeling
    分析一套源代码的代码规范和风格并讨论如何改进优化代码
    结合工程实践选题调研分析同类软件产品
    如何提高程序员的键盘使用效率
    python知识准备及环境配置
    一张图片在Python操作下的4种玩法(附源码)
    Python中的错误和异常
    当你忘记网站上的密码时怎么办?Python如何快速帮你找回?
    Python最简单的图片爬虫,20行代码带你爬遍整个网站
  • 原文地址:https://www.cnblogs.com/abeen/p/9355389.html
Copyright © 2011-2022 走看看