centos7安装python3 恰饭了

centos7 安装python3.6.9

  1. 安装依赖环境
    安装zlib-dev sudo yum install zlib* (安装原因:报错:zipimport.ZipImportError)
    安装gcc sudo yum install gcc (安装原因: configure: error: no acceptable C compiler found in $PATH)
    或者安装 sudo yum install -y ncurses-libs zlib-devel mysql-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel

  2. 创建文件夹
    sudo mkdir /usr/local/python3
    cd /usr/local/python3

  3. 下载软件包
    官网源: wget https://www.python.org/ftp/python/3.6.9/Python-3.6.9.tar.xz
    传送门 (贼快) :https://download.csdn.net/download/llm765800916/12303074

  4. 解压 tar -xvJf Python-3.6.9.tar.xz

  5. 编译安装:
    1. cd python-3.6.9
    2. ./configure --prefix=/usr/local/python3 #没安装gcc会报错
    3. sudo make && make install #面对疾风吧

  6. 创建软连接
    ln -s /usr/local/python3/bin/python3 /usr/bin/python3
    ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

  7. 人生苦短,python面世centos7安装python3 恰饭了_第1张图片

你可能感兴趣的:(python,linux)