美文网首页
笔记:Linux安装python

笔记:Linux安装python

作者: ChanZeeBm | 来源:发表于2022-07-27 19:28 被阅读0次

    If using RHEL/Fedora:

    yum install libffi-devel
    

    If using Debian/Ubuntu:

    apt-get install libffi-dev
    

    Python3中有个内置模块叫ctypes,它是Python3的外部函数库模块,它提供兼容C语言的数据类型,并通过它调用Linux系统下的共享库(Shared library),此模块需要使用CentOS7系统中外部函数库(Foreign function library)的开发链接库(头文件和链接库)。

    因此,需要先安装以上dev库再安装python。

    python安装

    安装底层依赖:

    For Debian

    # for xz
    apt install xz-utils
    # for sqlite3-dev
    apt install libsqlite3-dev
    # for bz2
    apt install libbz2-dev
    # for ssl
    apt install libssl-dev
    # for ctypes
    apt install libffi-dev
    
    

    For Centos

    # for xz
    yum install xz
    yum install sqlite3-devel
    yum install bzip2-devel
    yum install openssl
    yum install libffi-devel
    
    
    # debian dependencies
    apt-get install build-essential gdb lcov pkg-config \
          libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \
          libncurses5-dev libreadline6-dev libsqlite3-dev libssl-dev \
          lzma lzma-dev tk-dev uuid-dev zlib1g-dev
    # 安装make
    apt install make
    # 安装gcc
    apt install gcc
    # 安装g++
    apt install g++
    # 安装sqlite3-dev
    # 
    # 解压python3.8.12.tar.gz
    tar -xvf python3.8.12.tar.xz
    # 进入目录
    cd python3.8.12
    ./configure --enable-optimizations --enable-loadable-sqlite-extensions --with-ssl
    # 构造文件
    make -j 4
    # 安装
    make altinstall
    
    

    相关文章

      网友评论

          本文标题:笔记:Linux安装python

          本文链接:https://www.haomeiwen.com/subject/fqnzirtx.html