• [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
    
  • 相关阅读:
    Visual C++6.0 调用Visual Basic 6.0写的Microsoft Communications Control(ActiveX)的使用疑难及解决办法
    Associating Icons with a Category 与 恶作剧软件 有关系吗?
    WPF/Silverlight Button Styles and Templates
    Notepad++ 备忘录一
    冥思苦想,木疙瘩也能崩出个豆:扯一下各大软件的用户体验
    生活小窍门。
    Bug验证:.Net 4 下,貌似发现一个bug。如果是真,.Net组的员工该打屁股。
    两台硬件和软件配置完全相同的机器A和B,现在要用系统自带的Copy功能把A上的一个文件,复制到B上。在哪台机器上执行程序,效率更高?
    WPF 遍历 DataGrid 每行的控件
    IE ActiveX Control 和RIA
  • 原文地址:https://www.cnblogs.com/abeen/p/9355389.html
Copyright © 2020-2023  润新知