Linux 源码安装 Python3

时间:2023-12-20 08:42:32
  1. 下载源码包
    https://www.python.org/downloads/
  2. 解压(以3.64版本为例)
    wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tgz
    tar -zxvf Python-3.6.4.tgz
    cd Python-3.6.4
  3. 安装
    ./configure --prefix=/usr/local/python3
    make && make install
  4. 添加软链接
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
  5. 安装第三方库
    yum install python-pip  
    pip install --upgrade pip
    python3 -m pip freeze
    python3 -m pip install redis
    python3 -m pip install pymongo
    python3 -m pip install pymysql
    python3 -m pip install configparser
    豆瓣源:
    pip Install:pip install -i https://pypi.douban.com/simple/