关于python:centos7-安装python-3

53次阅读

共计 556 个字符,预计需要花费 2 分钟才能阅读完成。

  • 下载
wget -c https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tgz  
  • 解压到 /usr/local/
  • 依赖包装置
yum install libffi-devel
yum install openssl-devel

// 可能还有一些依赖的,我的环境之前曾经装置过
// yum install openssl-devel bzip2-devel expat-devel gdbm-devel readline-devel sqlite-devel

  • 编译
cd Python-3.9.6/
mkdir /usr/local/python3
./configure -prefix=/usr/local/python3
make
make install
  • 链接 python3. pip3

    ln -s /usr/local/python3/bin/python3.9 /usr/bin/python3
    ln -s /usr/local/python3/bin/pip3.9 /usr/bin/pip3
  • 测试

    $ python3 --version
    Python 3.9.6
    $ pip3 --version
    pip 21.1.3 from /usr/local/python3/lib/python3.9/site-packages/pip (python 3.9)

正文完
 0