zoukankan      html  css  js  c++  java
  • centos7 install python3.7 with problem and how to fix it.

    问题如下:

    configure: error: no acceptable C compiler found in $PATH
    缺少gcc
    zipimport.ZipImportError: can’t decompress data 缺少zlib,zlib
    -devel

    No module named '_ctypes'
    3.7版本需要一个新的包libffi-devel

    yum install libffi-devel -y  

    解决如下:

    yum install gcc zlib zlib-devel -y
    yum install libffi-devel -y  
    有关openssl的修复,python找不到ssl模块
    安装模块
    yum install openssl-devel -y
    去掉注视
    # Socket module helper for socket(2)
    _socket socketmodule.c
    
    # Socket module helper for SSL support; you must comment out the other
    # socket line above, and possibly edit the SSL variable:
    SSL=/usr/local/ssl
    _ssl _ssl.c 
            -DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl 
            -L$(SSL)/lib -lssl -lcrypto
    有关zlib的修复
    1  到python安装目录下,运行./configure
    
    2  编辑Modules/Setup文件
    
        vim Modules/Setup
    
        找到下面这句,去掉注释
    
        #zlib zlibmodule.c -I$(prefix)/include -L$(exec_prefix)/lib -lz
    重新编译python3.7
    ./configure --prefix=/usr/local/python3.7
    make && make install

     建立软连接:

    ln -s /usr/local/python3.7/bin/python3 /usr/bin/python3
    ln -s /usr/local/python3.7/bin/pip3 /usr/bin/pip3

    效果:

     顺便安装了Ipython:

    pip3 install ipython  #这里必须解决上面ssl模块的问题
    ln -s /usr/local/python3.7/bin/ipython /usr/bin/ipython

    因为缺少sqlite数据库模块,还有个报错:

    /usr/local/python3.7/lib/python3.7/site-packages/IPython/core/history.py:226: UserWarning: IPython History requires SQLite, your history will not be saved
      warn("IPython History requires SQLite, your history will not be saved")

    解决方法:

    yum install sqlite-devel -y
    重新编译python3.7
    这些坑相当头疼,所以提早把环境给装好

    Ipython效果:

  • 相关阅读:
    'Undefined symbols for architecture i386,clang: error: linker command failed with exit code 1
    The codesign tool requires there only be one 解决办法
    XCode iOS project only shows “My Mac 64bit” but not simulator or device
    Provisioning profile XXXX can't be found 的解决办法
    UIView 中的控件事件穿透 Passthrough 的实现
    Xcode4.5出现时的OC新语法
    xcode 快捷键(持续更新)
    打越狱包
    php缓存与加速分析与汇总
    浏览器的判断
  • 原文地址:https://www.cnblogs.com/pyyu/p/8708033.html
Copyright © 2011-2022 走看看